-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/compile: -ldflags=-X=VAL does not work #29719
Comments
Same issue with Go 1.11.4 go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/username/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/username/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.4/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/username/work/project/go.mod"
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 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/xz/m_txgcw11956v_f03r_xz4880000gn/T/go-build167362921=/tmp/go-build -gno-record-gcc-switches -fno-common"
|
I am unable to reproduce this -
Are you sure this is not a bash/shell issue ? |
@agnivade , pretty sure. |
Then I am not sure what is happening here. Could you make a stripped down main.go which just imports package main
import (
"fmt"
"github.com/prometheus/common/version"
)
func main() {
fmt.Println(version.Print("hello"))
}
|
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
The same result is with 1.10.7.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I run a build with the following ldflags:
https://github.com/greenpau/network_exporter/blob/master/Makefile#L19-L34
What did you expect to see?
My code depends on external llibrary
github.com/prometheus/common
. As part of the build, I set the values for the following variables https://github.com/prometheus/common/blob/master/version/info.go#L27-L34.During the startup of the application, I expect seeing version, branch, revision, etc. information.
What did you see instead?
Instead I see that ldflags didn't work.
The text was updated successfully, but these errors were encountered: