Skip to content

Ldflags and "linker" #325

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

Open
vron opened this issue Oct 11, 2015 · 8 comments
Open

Ldflags and "linker" #325

vron opened this issue Oct 11, 2015 · 8 comments

Comments

@vron
Copy link

vron commented Oct 11, 2015

Hi,

I often use the -X importpath.name=value functionality to implement versions of my applications (e.g. pulling the git hash as part of my build process). I think this, or something similar, would be a useful addition to gopherjs. Any thoughs?

Would a change/addition like this be accepted? Would anyone mind pointing me in the correct direction in the source?

@neelance
Copy link
Member

Yes, that feature would be welcome. :-) The first implementation that comes to my mind would be to fake entries in InitOrder here: https://github.com/gopherjs/gopherjs/blob/master/compiler/package.go#L247

@neelance
Copy link
Member

@vron Are you looking into it? If you get stuck, feel free to ask me on the Gophers Slack. I could also look into this myself, I just want to make sure that we're not working on the feature at the same time.

@vron
Copy link
Author

vron commented Oct 18, 2015

@neelance I did look into it a bit, but since I am not fluent in the gopherjs code it became slighty more compicated than I hoped. I have solved my direct need in other ways (updating source). I.e. I am not currently looking at this, no.

@dmitshur
Copy link
Member

+1, I'm interested in this functionality too. Maybe I'll try to look into it soon.

@dmitshur
Copy link
Member

What should the API for this look like?

Does GopherJS have a concept of a distinct compiler and linker, @neelance?

Would we want to support any other of go linker flags?

@dmitshur dmitshur added the gopherjs-tool Related to the gopherjs tool or its build system (but not the compiler itself). label Jan 27, 2016
@dmitshur
Copy link
Member

This issue will not be automatically/immediately resolved by my WIP implementation of #388. It will be possible, but there's still custom work needed to support this for JS environment.

That's why I'll remove the "cmd/go would not have this issue" label from this issue. We can implement it after #388 is resolved.

@dmitshur dmitshur added enhancement and removed gopherjs-tool Related to the gopherjs tool or its build system (but not the compiler itself). labels Jun 27, 2016
@pjebs
Copy link
Contributor

pjebs commented Nov 24, 2019

@nevkontakte
Copy link
Member

@pjebs I'm afraid there is no current implementation for this feature, although I agree it'd be nice to have.

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

No branches or pull requests

5 participants