(no title)
zalmoxes | 8 years ago
It's doable, but it was hard and while cobra is a nice library, it's probably overkill unless you're a project like kubernetes.
Most projects in Go are very small in terms of configuration surface, and something like https://github.com/kolide/launcher/blob/9dcf149957b9e9757a24... is much cleaner IMO.
justinsaccount|8 years ago
I'm currently using PersistentPreRunE to bootstrap the logging and store.. but I'm not really happy with the end result and some things are awkward. Maybe it would be less awkward if cobra had a 'Context' I could stick things in. The last issue was I added a version subcommand, which kept creating the store. I ended up having to do
Which would have been a lot simpler if I was doing things manually.