You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe it's just me, but it seems that calling flag.Parse() in redis.go/init() is causing my other flags to get ignored, maybe because this package loads before the "main" package? (I'm new to Go, so could be my mistake - and of course you can't be sure that any main package will actually call flag.Parse()).
Also, why is init() calling runtime.GOMAXPROCS(2) ?
The text was updated successfully, but these errors were encountered:
flag.Parse is eating my app's command-line arguments. I've figured out a way to patch redis.go to fail but not bring flag's parsing operation with it, but there's no simple way in the 'flag' package to move past errors silently, so flags other than redis:d still cause an error message. It does at least suppress the usage message flag would normally print.
failf on http://golang.org/src/pkg/flag/flag.go line 643 shows how that parse error message gets generated, and there's no way to overwrite that handler without a patch to the main go language.
https://gist.github.com/3201682 is my updated init() for redis.go. It works because it doesn't try to use the default command line FlagSet and propagate the failure forward to the user's application. The overwrite of Usage is for error message suppression. I can put it in patch format if you want to add this in.
Maybe it's just me, but it seems that calling flag.Parse() in redis.go/init() is causing my other flags to get ignored, maybe because this package loads before the "main" package? (I'm new to Go, so could be my mistake - and of course you can't be sure that any main package will actually call flag.Parse()).
Also, why is init() calling runtime.GOMAXPROCS(2) ?
The text was updated successfully, but these errors were encountered: