-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
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=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/dma2/Code/go"
GORACE=""
GOROOT="/home/dma2/Code/go/src/github.com/cloudflare/tls-tris/_dev/go1.10"
GOTOOLDIR="/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1"
GCCGO="/usr/bin/gccgo"
CC="/usr/bin/gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build074293983=/tmp/go-build -gno-record-gcc-switches"
CXX="/usr/bin/g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
This works:
go build
go build -compiler gccgo
This doesn't:
go build -compiler gccgo -gccgoflags "-X main.gbBuildTime=$(date +'%Y.%m.%d.%H%M%S') -X main.gbCommitHash=$(git log --pretty=format:'%h' -n 1) -X main.gbGitVersionTag=$(git describe) -X main.gbMfwlibGitVersionTag=$(git --git-dir ../mfwlib/.git describe)"
What did you expect to see?
No errors. I wish to set some go variable using gccgoflags as I would use them with -ldflags.
I also wish more documentation as to how to set go variables when using gccgo and gccgoflags rather than go and ldflags.
What did you see instead?
github.com/go-sql-driver/mysql
gccgo: error: main.gbBuildTime=2018.04.30.102007: No such file or directory
gccgo: error: main.gbCommitHash=770fe0e: No such file or directory
gccgo: error: main.gbGitVersionTag=v1.14: No such file or directory
gccgo: error: main.gbMfwlibGitVersionTag=v1.55: No such file or directory
gccgo: error: unrecognized command line option ‘-X’
gccgo: error: unrecognized command line option ‘-X’
gccgo: error: unrecognized command line option ‘-X’
gccgo: error: unrecognized command line option ‘-X’