On Wed, Mar 24, 2021 at 3:30 PM Jan Mercl <0xj...@gmail.com> wrote: > > On Wed, Mar 24, 2021 at 11:25 PM Matt Mueller <mattmue...@gmail.com> wrote: > > > I noticed a lonely BUG comment without an explanation in the flag package: > > https://github.com/golang/go/blob/master/src/flag/flag.go#L955 > > Looking at the code it seems to me that the comment is saying the > _client_ code has a bug in that it defines the same flag more than > once.
That could be, but BUG usually indicates something that should be changed in the Go code. In this case the original (and pretty much still current) code is m := flags.formal; flag, alreadythere = m[name]; // BUG I bet that there was a bug in the compiler back in 2008 such that flag, alreadythere = flag.formal[name]; didn't work, and the BUG refers to introducing a local variable that is only used once. If someone wants to send a CL removing the comment and removing the local variable m that would be fine. Thanks. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcUnM_QF0REt6AhxTzNd2xNdY%2BP%3D_eWDs5Jht7rk-C%2BwmA%40mail.gmail.com.