mirror of
https://github.com/vbatts/go-mtree.git
synced 2025-07-02 05:48:30 +00:00
go: go get -u ./... && go mod vendor && go mod tidy
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
a9c6969125
commit
e73ff94ef9
162 changed files with 1835 additions and 2997 deletions
8
vendor/github.com/sirupsen/logrus/README.md
generated
vendored
8
vendor/github.com/sirupsen/logrus/README.md
generated
vendored
|
@ -9,7 +9,7 @@ the last thing you want from your Logging library (again...).
|
|||
|
||||
This does not mean Logrus is dead. Logrus will continue to be maintained for
|
||||
security, (backwards compatible) bug fixes, and performance (where we are
|
||||
limited by the interface).
|
||||
limited by the interface).
|
||||
|
||||
I believe Logrus' biggest contribution is to have played a part in today's
|
||||
widespread use of structured logging in Golang. There doesn't seem to be a
|
||||
|
@ -43,7 +43,7 @@ plain text):
|
|||
With `log.SetFormatter(&log.JSONFormatter{})`, for easy parsing by logstash
|
||||
or Splunk:
|
||||
|
||||
```json
|
||||
```text
|
||||
{"animal":"walrus","level":"info","msg":"A group of walrus emerges from the
|
||||
ocean","size":10,"time":"2014-03-10 19:57:38.562264131 -0400 EDT"}
|
||||
|
||||
|
@ -99,7 +99,7 @@ time="2015-03-26T01:27:38-04:00" level=fatal method=github.com/sirupsen/arcticcr
|
|||
```
|
||||
Note that this does add measurable overhead - the cost will depend on the version of Go, but is
|
||||
between 20 and 40% in recent tests with 1.6 and 1.7. You can validate this in your
|
||||
environment via benchmarks:
|
||||
environment via benchmarks:
|
||||
```
|
||||
go test -bench=.*CallerTracing
|
||||
```
|
||||
|
@ -317,6 +317,8 @@ log.SetLevel(log.InfoLevel)
|
|||
It may be useful to set `log.Level = logrus.DebugLevel` in a debug or verbose
|
||||
environment if your application has that.
|
||||
|
||||
Note: If you want different log levels for global (`log.SetLevel(...)`) and syslog logging, please check the [syslog hook README](hooks/syslog/README.md#different-log-levels-for-local-and-remote-logging).
|
||||
|
||||
#### Entries
|
||||
|
||||
Besides the fields added with `WithField` or `WithFields` some fields are
|
||||
|
|
36
vendor/github.com/sirupsen/logrus/writer.go
generated
vendored
36
vendor/github.com/sirupsen/logrus/writer.go
generated
vendored
|
@ -4,6 +4,7 @@ import (
|
|||
"bufio"
|
||||
"io"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Writer at INFO level. See WriterLevel for details.
|
||||
|
@ -20,15 +21,18 @@ func (logger *Logger) WriterLevel(level Level) *io.PipeWriter {
|
|||
return NewEntry(logger).WriterLevel(level)
|
||||
}
|
||||
|
||||
// Writer returns an io.Writer that writes to the logger at the info log level
|
||||
func (entry *Entry) Writer() *io.PipeWriter {
|
||||
return entry.WriterLevel(InfoLevel)
|
||||
}
|
||||
|
||||
// WriterLevel returns an io.Writer that writes to the logger at the given log level
|
||||
func (entry *Entry) WriterLevel(level Level) *io.PipeWriter {
|
||||
reader, writer := io.Pipe()
|
||||
|
||||
var printFunc func(args ...interface{})
|
||||
|
||||
// Determine which log function to use based on the specified log level
|
||||
switch level {
|
||||
case TraceLevel:
|
||||
printFunc = entry.Trace
|
||||
|
@ -48,23 +52,51 @@ func (entry *Entry) WriterLevel(level Level) *io.PipeWriter {
|
|||
printFunc = entry.Print
|
||||
}
|
||||
|
||||
// Start a new goroutine to scan the input and write it to the logger using the specified print function.
|
||||
// It splits the input into chunks of up to 64KB to avoid buffer overflows.
|
||||
go entry.writerScanner(reader, printFunc)
|
||||
|
||||
// Set a finalizer function to close the writer when it is garbage collected
|
||||
runtime.SetFinalizer(writer, writerFinalizer)
|
||||
|
||||
return writer
|
||||
}
|
||||
|
||||
// writerScanner scans the input from the reader and writes it to the logger
|
||||
func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) {
|
||||
scanner := bufio.NewScanner(reader)
|
||||
for scanner.Scan() {
|
||||
printFunc(scanner.Text())
|
||||
|
||||
// Set the buffer size to the maximum token size to avoid buffer overflows
|
||||
scanner.Buffer(make([]byte, bufio.MaxScanTokenSize), bufio.MaxScanTokenSize)
|
||||
|
||||
// Define a split function to split the input into chunks of up to 64KB
|
||||
chunkSize := bufio.MaxScanTokenSize // 64KB
|
||||
splitFunc := func(data []byte, atEOF bool) (int, []byte, error) {
|
||||
if len(data) >= chunkSize {
|
||||
return chunkSize, data[:chunkSize], nil
|
||||
}
|
||||
|
||||
return bufio.ScanLines(data, atEOF)
|
||||
}
|
||||
|
||||
// Use the custom split function to split the input
|
||||
scanner.Split(splitFunc)
|
||||
|
||||
// Scan the input and write it to the logger using the specified print function
|
||||
for scanner.Scan() {
|
||||
printFunc(strings.TrimRight(scanner.Text(), "\r\n"))
|
||||
}
|
||||
|
||||
// If there was an error while scanning the input, log an error
|
||||
if err := scanner.Err(); err != nil {
|
||||
entry.Errorf("Error while reading from Writer: %s", err)
|
||||
}
|
||||
|
||||
// Close the reader when we are done
|
||||
reader.Close()
|
||||
}
|
||||
|
||||
// WriterFinalizer is a finalizer function that closes then given writer when it is garbage collected
|
||||
func writerFinalizer(writer *io.PipeWriter) {
|
||||
writer.Close()
|
||||
}
|
||||
|
|
15
vendor/github.com/urfave/cli/v2/app.go
generated
vendored
15
vendor/github.com/urfave/cli/v2/app.go
generated
vendored
|
@ -332,11 +332,18 @@ func (a *App) RunContext(ctx context.Context, arguments []string) (err error) {
|
|||
return a.rootCommand.Run(cCtx, arguments...)
|
||||
}
|
||||
|
||||
// This is a stub function to keep public API unchanged from old code
|
||||
//
|
||||
// Deprecated: use App.Run or App.RunContext
|
||||
// RunAsSubcommand is for legacy/compatibility purposes only. New code should only
|
||||
// use App.RunContext. This function is slated to be removed in v3.
|
||||
func (a *App) RunAsSubcommand(ctx *Context) (err error) {
|
||||
return a.RunContext(ctx.Context, ctx.Args().Slice())
|
||||
a.Setup()
|
||||
|
||||
cCtx := NewContext(a, nil, ctx)
|
||||
cCtx.shellComplete = ctx.shellComplete
|
||||
|
||||
a.rootCommand = a.newRootCommand()
|
||||
cCtx.Command = a.rootCommand
|
||||
|
||||
return a.rootCommand.Run(cCtx, ctx.Args().Slice()...)
|
||||
}
|
||||
|
||||
func (a *App) suggestFlagFromError(err error, command string) (string, error) {
|
||||
|
|
1
vendor/github.com/urfave/cli/v2/command.go
generated
vendored
1
vendor/github.com/urfave/cli/v2/command.go
generated
vendored
|
@ -135,6 +135,7 @@ func (c *Command) setup(ctx *Context) {
|
|||
if scmd.HelpName == "" {
|
||||
scmd.HelpName = fmt.Sprintf("%s %s", c.HelpName, scmd.Name)
|
||||
}
|
||||
scmd.separator = c.separator
|
||||
newCmds = append(newCmds, scmd)
|
||||
}
|
||||
c.Subcommands = newCmds
|
||||
|
|
24
vendor/github.com/urfave/cli/v2/context.go
generated
vendored
24
vendor/github.com/urfave/cli/v2/context.go
generated
vendored
|
@ -56,6 +56,7 @@ func (cCtx *Context) Set(name, value string) error {
|
|||
|
||||
// IsSet determines if the flag was actually set
|
||||
func (cCtx *Context) IsSet(name string) bool {
|
||||
|
||||
if fs := cCtx.lookupFlagSet(name); fs != nil {
|
||||
isSet := false
|
||||
fs.Visit(func(f *flag.Flag) {
|
||||
|
@ -72,7 +73,23 @@ func (cCtx *Context) IsSet(name string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
return f.IsSet()
|
||||
if f.IsSet() {
|
||||
return true
|
||||
}
|
||||
|
||||
// now redo flagset search on aliases
|
||||
aliases := f.Names()
|
||||
fs.Visit(func(f *flag.Flag) {
|
||||
for _, alias := range aliases {
|
||||
if f.Name == alias {
|
||||
isSet = true
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if isSet {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
|
@ -204,9 +221,10 @@ func (cCtx *Context) checkRequiredFlags(flags []Flag) requiredFlagsErr {
|
|||
var flagPresent bool
|
||||
var flagName string
|
||||
|
||||
for _, key := range f.Names() {
|
||||
flagName = key
|
||||
flagNames := f.Names()
|
||||
flagName = flagNames[0]
|
||||
|
||||
for _, key := range flagNames {
|
||||
if cCtx.IsSet(strings.TrimSpace(key)) {
|
||||
flagPresent = true
|
||||
}
|
||||
|
|
11
vendor/github.com/urfave/cli/v2/docs.go
generated
vendored
11
vendor/github.com/urfave/cli/v2/docs.go
generated
vendored
|
@ -153,9 +153,14 @@ func prepareFlags(
|
|||
// flagDetails returns a string containing the flags metadata
|
||||
func flagDetails(flag DocGenerationFlag) string {
|
||||
description := flag.GetUsage()
|
||||
value := flag.GetValue()
|
||||
if value != "" {
|
||||
description += " (default: " + value + ")"
|
||||
if flag.TakesValue() {
|
||||
defaultText := flag.GetDefaultText()
|
||||
if defaultText == "" {
|
||||
defaultText = flag.GetValue()
|
||||
}
|
||||
if defaultText != "" {
|
||||
description += " (default: " + defaultText + ")"
|
||||
}
|
||||
}
|
||||
return ": " + description
|
||||
}
|
||||
|
|
7
vendor/github.com/urfave/cli/v2/flag_bool.go
generated
vendored
7
vendor/github.com/urfave/cli/v2/flag_bool.go
generated
vendored
|
@ -52,7 +52,7 @@ func (b *boolValue) String() string {
|
|||
func (b *boolValue) IsBoolFlag() bool { return true }
|
||||
|
||||
func (b *boolValue) Count() int {
|
||||
if b.count != nil {
|
||||
if b.count != nil && *b.count > 0 {
|
||||
return *b.count
|
||||
}
|
||||
return 0
|
||||
|
@ -130,6 +130,11 @@ func (f *BoolFlag) Apply(set *flag.FlagSet) error {
|
|||
if count == nil {
|
||||
count = new(int)
|
||||
}
|
||||
|
||||
// since count will be incremented for each alias as well
|
||||
// subtract number of aliases from overall count
|
||||
*count -= len(f.Aliases)
|
||||
|
||||
if dest == nil {
|
||||
dest = new(bool)
|
||||
}
|
||||
|
|
9
vendor/github.com/urfave/cli/v2/flag_generic.go
generated
vendored
9
vendor/github.com/urfave/cli/v2/flag_generic.go
generated
vendored
|
@ -117,13 +117,8 @@ func (cCtx *Context) Generic(name string) interface{} {
|
|||
}
|
||||
|
||||
func lookupGeneric(name string, set *flag.FlagSet) interface{} {
|
||||
f := set.Lookup(name)
|
||||
if f != nil {
|
||||
parsed, err := f.Value, error(nil)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return parsed
|
||||
if f := set.Lookup(name); f != nil {
|
||||
return f.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
9
vendor/github.com/urfave/cli/v2/flag_path.go
generated
vendored
9
vendor/github.com/urfave/cli/v2/flag_path.go
generated
vendored
|
@ -90,13 +90,8 @@ func (cCtx *Context) Path(name string) string {
|
|||
}
|
||||
|
||||
func lookupPath(name string, set *flag.FlagSet) string {
|
||||
f := set.Lookup(name)
|
||||
if f != nil {
|
||||
parsed, err := f.Value.String(), error(nil)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return parsed
|
||||
if f := set.Lookup(name); f != nil {
|
||||
return f.Value.String()
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
6
vendor/github.com/urfave/cli/v2/flag_string.go
generated
vendored
6
vendor/github.com/urfave/cli/v2/flag_string.go
generated
vendored
|
@ -87,10 +87,8 @@ func (cCtx *Context) String(name string) string {
|
|||
}
|
||||
|
||||
func lookupString(name string, set *flag.FlagSet) string {
|
||||
f := set.Lookup(name)
|
||||
if f != nil {
|
||||
parsed := f.Value.String()
|
||||
return parsed
|
||||
if f := set.Lookup(name); f != nil {
|
||||
return f.Value.String()
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
9
vendor/github.com/urfave/cli/v2/flag_timestamp.go
generated
vendored
9
vendor/github.com/urfave/cli/v2/flag_timestamp.go
generated
vendored
|
@ -145,11 +145,6 @@ func (f *TimestampFlag) Apply(set *flag.FlagSet) error {
|
|||
|
||||
f.defaultValue = f.Value.clone()
|
||||
|
||||
if f.Destination != nil {
|
||||
f.Destination.SetLayout(f.Layout)
|
||||
f.Destination.SetLocation(f.Timezone)
|
||||
}
|
||||
|
||||
if val, source, found := flagFromEnvOrFile(f.EnvVars, f.FilePath); found {
|
||||
if err := f.Value.Set(val); err != nil {
|
||||
return fmt.Errorf("could not parse %q as timestamp value from %s for flag %s: %s", val, source, f.Name, err)
|
||||
|
@ -157,6 +152,10 @@ func (f *TimestampFlag) Apply(set *flag.FlagSet) error {
|
|||
f.HasBeenSet = true
|
||||
}
|
||||
|
||||
if f.Destination != nil {
|
||||
*f.Destination = *f.Value
|
||||
}
|
||||
|
||||
for _, name := range f.Names() {
|
||||
if f.Destination != nil {
|
||||
set.Var(f.Destination, name, f.Usage)
|
||||
|
|
7
vendor/github.com/urfave/cli/v2/godoc-current.txt
generated
vendored
7
vendor/github.com/urfave/cli/v2/godoc-current.txt
generated
vendored
|
@ -141,7 +141,7 @@ USAGE:
|
|||
DESCRIPTION:
|
||||
{{template "descriptionTemplate" .}}{{end}}{{if .VisibleCommands}}
|
||||
|
||||
COMMANDS:{{template "visibleCommandTemplate" .}}{{end}}{{if .VisibleFlagCategories}}
|
||||
COMMANDS:{{template "visibleCommandCategoryTemplate" .}}{{end}}{{if .VisibleFlagCategories}}
|
||||
|
||||
OPTIONS:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}}
|
||||
|
||||
|
@ -357,9 +357,8 @@ func (a *App) RunAndExitOnError()
|
|||
code in the cli.ExitCoder
|
||||
|
||||
func (a *App) RunAsSubcommand(ctx *Context) (err error)
|
||||
This is a stub function to keep public API unchanged from old code
|
||||
|
||||
Deprecated: use App.Run or App.RunContext
|
||||
RunAsSubcommand is for legacy/compatibility purposes only. New code should
|
||||
only use App.RunContext. This function is slated to be removed in v3.
|
||||
|
||||
func (a *App) RunContext(ctx context.Context, arguments []string) (err error)
|
||||
RunContext is like Run except it takes a Context that will be passed to
|
||||
|
|
21
vendor/github.com/urfave/cli/v2/help.go
generated
vendored
21
vendor/github.com/urfave/cli/v2/help.go
generated
vendored
|
@ -42,6 +42,7 @@ var helpCommand = &Command{
|
|||
// 3 $ app foo
|
||||
// 4 $ app help foo
|
||||
// 5 $ app foo help
|
||||
// 6 $ app foo -h (with no other sub-commands nor flags defined)
|
||||
|
||||
// Case 4. when executing a help command set the context to parent
|
||||
// to allow resolution of subsequent args. This will transform
|
||||
|
@ -77,6 +78,8 @@ var helpCommand = &Command{
|
|||
HelpPrinter(cCtx.App.Writer, templ, cCtx.Command)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Case 6, handling incorporated in the callee itself
|
||||
return ShowSubcommandHelp(cCtx)
|
||||
},
|
||||
}
|
||||
|
@ -206,9 +209,15 @@ func printFlagSuggestions(lastArg string, flags []Flag, writer io.Writer) {
|
|||
|
||||
func DefaultCompleteWithFlags(cmd *Command) func(cCtx *Context) {
|
||||
return func(cCtx *Context) {
|
||||
if len(os.Args) > 2 {
|
||||
lastArg := os.Args[len(os.Args)-2]
|
||||
var lastArg string
|
||||
|
||||
// TODO: This shouldnt depend on os.Args rather it should
|
||||
// depend on root arguments passed to App
|
||||
if len(os.Args) > 2 {
|
||||
lastArg = os.Args[len(os.Args)-2]
|
||||
}
|
||||
|
||||
if lastArg != "" {
|
||||
if strings.HasPrefix(lastArg, "-") {
|
||||
if cmd != nil {
|
||||
printFlagSuggestions(lastArg, cmd.Flags, cCtx.App.Writer)
|
||||
|
@ -292,8 +301,12 @@ func ShowSubcommandHelp(cCtx *Context) error {
|
|||
if cCtx == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
HelpPrinter(cCtx.App.Writer, SubcommandHelpTemplate, cCtx.Command)
|
||||
// use custom template when provided (fixes #1703)
|
||||
templ := SubcommandHelpTemplate
|
||||
if cCtx.Command != nil && cCtx.Command.CustomHelpTemplate != "" {
|
||||
templ = cCtx.Command.CustomHelpTemplate
|
||||
}
|
||||
HelpPrinter(cCtx.App.Writer, templ, cCtx.Command)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
2
vendor/github.com/urfave/cli/v2/template.go
generated
vendored
2
vendor/github.com/urfave/cli/v2/template.go
generated
vendored
|
@ -88,7 +88,7 @@ USAGE:
|
|||
DESCRIPTION:
|
||||
{{template "descriptionTemplate" .}}{{end}}{{if .VisibleCommands}}
|
||||
|
||||
COMMANDS:{{template "visibleCommandTemplate" .}}{{end}}{{if .VisibleFlagCategories}}
|
||||
COMMANDS:{{template "visibleCommandCategoryTemplate" .}}{{end}}{{if .VisibleFlagCategories}}
|
||||
|
||||
OPTIONS:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue