Skip to content

Audit command-line input parsing for obtuse errors #33

@hawkw

Description

@hawkw

Potential follow-on from #31 .

For example, passing a nonsense string to --lengthPercentiles sometimes gets me this:

panic: runtime error: index out of range

goroutine 1 [running]:
github.com/buoyantio/strest-grpc/client/percentiles.ParsePercentiles(0x7fff5fbff873, 0x4, 0x0, 0x0, 0x0)
        /Users/eliza/Code/go/src/github.com/buoyantio/strest-grpc/client/percentiles/percentiles.go:38 +0x2bb
github.com/buoyantio/strest-grpc/client.Config.Run(0x151fbe2, 0xe, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x2540be400, 0x1519c9e, ...)
        /Users/eliza/Code/go/src/github.com/buoyantio/strest-grpc/client/client.go:388 +0x233
github.com/buoyantio/strest-grpc/cmd.glob..func1(0x17e0a00, 0xc4200496a0, 0x0, 0x1)
        /Users/eliza/Code/go/src/github.com/buoyantio/strest-grpc/cmd/client.go:17 +0x5a
github.com/buoyantio/strest-grpc/vendor/github.com/spf13/cobra.(*Command).execute(0x17e0a00, 0xc420049680, 0x1, 0x1, 0x17e0a00, 0xc420049680)
        /Users/eliza/Code/go/src/github.com/buoyantio/strest-grpc/vendor/github.com/spf13/cobra/command.go:702 +0x2c6
github.com/buoyantio/strest-grpc/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x17e0c20, 0x17e66d0, 0xc420125f70, 0x1006164)
        /Users/eliza/Code/go/src/github.com/buoyantio/strest-grpc/vendor/github.com/spf13/cobra/command.go:783 +0x30e
github.com/buoyantio/strest-grpc/vendor/github.com/spf13/cobra.(*Command).Execute(0x17e0c20, 0x24, 0xc4201701e0)
        /Users/eliza/Code/go/src/github.com/buoyantio/strest-grpc/vendor/github.com/spf13/cobra/command.go:736 +0x2b
main.main()
        /Users/eliza/Code/go/src/github.com/buoyantio/strest-grpc/main.go:11 +0x31

It would be nice to hook as much of this as possible into Cobra's validation?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions