Ldflags setting package variable not working

Hey guys,

Alright I’m running into an issue ONLY on my build machine and I can’t understand why.

so I have a Library that exposes Build Variable (such as build date) and that I’m compiling like this:

cd $GOPATH/src/github.com/tom/my_project
 go build -v -ldflags '-X github.com/tom/my_project/vendor/github.com/tom/my_lib_path.BuildDate=2016-11-08T12:31:22 -X main.Test=QWERTYUI' -o ~/my_project main.go

This works pretty well EXCEPT on my jenkins box which is where I build my projects… On the Jenkins machine Test is properly set up but BuildDate is empty. I can’t understand why and it’s driving me crazy. Anyone has an idea of what could be going on or a better way to do this?

Running the latest version of go, and did the exact same go install and workspace setup on a ubuntu 14.04 (which is working as expected). My guest at this point is jenkins installation change something on at the OS level but I can’t figure out what it could be.

The jenkins box is running Ubuntu 12.04.5 LTS and jenkins version is 1.656

does it work if you build a package, not a single .go file?

Alright I finally figured it out, I changed my repo path several weeks ago, and that change didn’t got to the server. Path were similar enough that I didn’t see it…

So yeah everything works as expected, sorry for the loss of time Dave :wink:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.