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/link: Support absolute import paths for main packages with -X #13676

Open
tsenart opened this Issue Dec 18, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@tsenart

tsenart commented Dec 18, 2015

What version of Go are you using (go version)?

go1.5.1

What operating system and processor architecture are you using?

darwin/amd64

What did you do?
$ go get -ldflags="-X github.com/tsenart/hello.Version=v0.0.1" github.com/tsenart/hello
$ hello
What did you expect to see?
v0.0.1
What did you see instead?

@tsenart

This comment has been minimized.

tsenart commented Dec 18, 2015

The context where this would be useful is when compiling many main packages with go build ./... and wanting to inject versions at build time for all of them in a single -ldflags. We can simply build each command separately but that slows everything down massively due to the duplicate building of interdependencies.

@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Dec 18, 2015

@minux

This comment has been minimized.

Member

minux commented Dec 18, 2015

@tsenart

This comment has been minimized.

tsenart commented Dec 18, 2015

@minux: Yes, I figured that out. Would it be a possibility to make it absolute instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment