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
For this kind of use you'll need to use -ldflags=all='...'. See https://golang.org/doc/go1.10#build. When you list the files explicitly like this, rather than building a package, the go tool doesn't know which package the -ldflags should apply to.
@ianlancetaylor Hi Ian, thanks for the reply. As I mentioned in the original description, though I know in v1.10 I should use another way, I would like to see the same/similar error message like v1.9.1 if the parameter format is not correct. Does that make sense? Thanks again.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go 1.10
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN="/mnt/Gopath/bin"
GOCACHE="/home/feilong/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/feilong/MyWorkspace/workspace_k8s"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build213708075=/tmp/go-build -gno-record-gcc-switches"
What did you do?
On go1.9.1, when I run command:
go build -ldflags '"-w -s -X 'main.version=c206dbe2'"' -o k8s-keystone-auth cmd/k8s-keystone-auth/main.go
I got this error, see http://paste.openstack.org/show/720640/
But on gov1.10, the build passed. However, the main.version is not set.
What did you expect to see?
I expect to see same behaviour as v1.9.1 if the ldflags can't be welly parsed.
What did you see instead?
The build passed, however the version is not set correctly.
The text was updated successfully, but these errors were encountered: