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
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
What did you do?
create a very simple pakcage, try to append version number during compile time
src/dummy/main.go
package main
import"fmt"var (
version="NONE"
)
funcmain() {
fmt.Printf("Version is %s\n", version)
}
What did you expect to see?
since below command will run without any error: go build -o bin/dummy -ldflags "-X main.version=1" dummy/ <- with /
it shall produce the same binary as by: go build -o bin/dummy -ldflags "-X main.version=1" dummy <- without /
What did you see instead?
The "with /" case, version is not set by -ldflags "-X main.version=1"
The text was updated successfully, but these errors were encountered:
This appears to be the same issue as reported in #24456.
andybons
changed the title
go buld -ldflags -X does not work if a package path endswith "/"
cmd/go: buld -ldflags -X does not work if a package path ends with "/"
Mar 21, 2018
What version of Go are you using (
go version
)?go version go1.10 linux/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
What did you do?
create a very simple pakcage, try to append version number during compile time
src/dummy/main.go
What did you expect to see?
since below command will run without any error:
go build -o bin/dummy -ldflags "-X main.version=1" dummy/
<- with /it shall produce the same binary as by:
go build -o bin/dummy -ldflags "-X main.version=1" dummy
<- without /What did you see instead?
The "with /" case, version is not set by
-ldflags "-X main.version=1"
The text was updated successfully, but these errors were encountered: