top | item 43453873

(no title)

mway | 11 months ago

Also a fan of go-flags, I use it by default most of the time (unless the use case is so basic that the stdlib flags usage would be sufficiently simple).

I think my only real point of "frustration" (mild at best) is that flag composability isn't always possible (eg embedding/sharing common non-root flags across flag structs), IIRC struct tag eval doesn't reach nested types.

Other than that though, it's one of those nice libraries that just does a thing and gets out of your way.

discuss

order

CamouflagedKiwi|11 months ago

Hmmmm I thought that sharing a common type did work in the way you would expect it to? I haven't tried embedding with it though I don't think.

TBH I rarely do it much anyway, mostly the flag struct ends up being one anonymous struct which is operated on in the main package only. I do like writing custom types for parsing though - I've seen engineers do a bunch of post-hoc parsing logic which generally just ends up being messy.