cmd/link: -X fails with periods #21206
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Milestone
what used to work in go 1.7.3 no longer works in go 1.8
What version of Go are you using (
go version
)?go version go1.8.3 linux/amd64
What operating system and processor architecture are you using (
go env
)?$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/sig/gopath"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build896116486=/tmp/go-build"
CXX="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?
run test_golink.sh (see below for script)
What did you expect to see?
"Version = 1.0.0"
What did you see instead?
"Version = dev"
test_golink.sh script
$ cat test_golink.sh
rm -rf gopath
mkdir gopath
cd gopath
export GOPATH=$HOME/gopath
mkdir -p src/mypackage.git/hello
cat << EOF > src/mypackage.git/config.go
package mypackage
var Version = "dev"
EOF
cat << EOF > src/mypackage.git/hello/main.go
package main
import (
"fmt"
"mypackage.git"
)
func main() {
fmt.Printf("version = %s\n", mypackage.Version)
}
EOF
go clean -i mypackage.git
go install -ldflags "-X mypackage%2egit.Version=1.0.0" mypackage.git mypackage.git/hello
go install mypackage.git/hello
./bin/hello
The text was updated successfully, but these errors were encountered: