Flag parameter and the order if you call your program with -help

I have an application with 4 parameters you can set on start. I use the flag package and I thought the order I have in my source code = order it’s listed in the console when you look at myapp.exe -help.

But that’s not the case, the order is different and I can’t see any logic behind it when I try to see a pattern between those too, is there any reason it’s not 1:1 as in the source?

Best regards :cactus:.

According to the documentation they are printed in lexicographical order. Can you verify that?


Should be indeed: https://golang.org/src/flag/flag.go#L290

1 Like

Verified. Damn, now I need new names for my variables.
Thanks for the answer.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.