How should struct tags be used in a command line interface library? #1
scott-cotton
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Often, I find that commands I write in Go have an associated struct containing its configuration. Then, one jumps through a myriad of needless actions to link this config structure to command flags/options. In Go stdlib one calls
flag.FooVar. In other libs with richer structures for flags, one needs to model them all and link them to the struct explicitly. Why not use struct tags?Then, there is kong, which uses struct tags for commands, which can include options. What's the right role for struct tags in this picture?
Beta Was this translation helpful? Give feedback.
All reactions