Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order of command line flags should not matter for bool/string var combo #19091

Closed
jennifer-yan opened this issue Feb 14, 2017 · 2 comments
Closed

Comments

@jennifer-yan
Copy link

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.7.5 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/Yan/Documents/gopro"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.7.5/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.7.5/libexec/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/29/gt8kf375525g048cvqywvq1c0000gn/T/go-build990621475=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

What did you do?

https://play.golang.org/p/PIeoe178RG

What did you expect to see?

I expect the order of the bool and string flag argument to not matter

What did you see instead?

Putting the string arg before the bool var on the command line works but the other way does not.

@ianlancetaylor
Copy link
Contributor

This is not a bug. The flag package docs say that the form -flag x is only support for non-boolean flags.

The last form is not permitted for boolean flags because the meaning of the command
		cmd -x *
will change if there is a file called 0, false, etc.  You must use the -flag=false form to turn off a boolean flag.

Closing.

@jennifer-yan
Copy link
Author

jennifer-yan commented Feb 14, 2017 via email

@golang golang locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants