-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remainder not supported with Verbs #12
Comments
A tangential issue related to documentation: I discovered that deeply nested verbs was possible, and specifically needed that feature. The docs might mention that verbs can be nested deeper than level 1, that is, that a verb struct may, itself, contain sub-verbs in addition to the already documented capability of containing flags. |
Thanks for opening issue! Your comment regarding the documentation is definitely valid. It just never occured to me to make something like that explicit as I thought of goptions parser as recursive in general ;) The If you, however, feel like fixing this yourself, please go ahead and make a pull-request. I will gladly review your code, esp. if you are just getting started :) |
I'd never be able to fix anything that uses reflect |
Came here intending to report the same issue. |
I'm just getting started in Go and should probably NOT submit any code yet, however when using your excellent options library that I read about here (http://dave.cheney.net/2013/11/07/subcommand-handling-in-go). I ran into a problem. The solution might just be to amend the documentation, or perhaps there's an actual fix. But when I used Remainder in the top level struct with verbs, I got a nasty reflect error:
panic: reflect: NumField of non-struct type
goroutine 1 [running]:
reflect.(*rtype).NumField(0x5e5560, 0xc20802e530)
/images/opt/go/src/reflect/type.go:657 +0x7a
github.com/voxelbrain/goptions.newFlagset(0x0, 0x0, 0x5e5560, 0xc20802e530, 0xd7, 0xc2080117a0, 0x7ffb282ca7e8)
/home/jagipson/go/src/github.com/voxelbrain/goptions/flagset.go:66 +0x23c
github.com/voxelbrain/goptions.newFlagset(0x695710, 0x4, 0x664e00, 0xc20802e500, 0xd9, 0x0, 0x7ffb282bd000)
/home/jagipson/go/src/github.com/voxelbrain/goptions/flagset.go:102 +0x889
github.com/voxelbrain/goptions.NewFlagSet(0x695710, 0x4, 0x5d5be0, 0xc20802e500, 0x0)
/home/jagipson/go/src/github.com/voxelbrain/goptions/flagset.go:46 +0x1a6
main.main()
/home/jagipson/go/src/github.com/jagipson/goreps/cmd/reps/reps.go:55 +0x84
exit status 2
That happens for this:
And goes away when I comment out the Remainder line
The text was updated successfully, but these errors were encountered: