Skip to content
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/go: make it easier for toolexec authors to get access to full package path #15677

josharian opened this issue May 13, 2016 · 2 comments


Copy link

commented May 13, 2016

I'm writing a toolexec-able program for which I want to know the full package path for whatever code is being operated on. The code to figure out this package path is currently a pile of hacks. E.g. for compile, look for the -p arg. For asm, use -trimpath to figure out $WORK and then slice that off the -o arg. This breaks down entirely for invocations of cgo with -dynpackage.

I would like to have cmd/go pass extra information when toolexec is in use. For backwards compatibility, I propose to do this via an environment variable, something like TOOLEXEC_PKG_PATH (improvements welcome). There might be other, similar bits of data to add in the future.

Feedback and suggestions requested. I'm going to hack this in myself anyway, it's just a question of whether I should plan to mail a CL at the end (for 1.8, of course).

@josharian josharian self-assigned this May 13, 2016

@josharian josharian added this to the Go1.8 milestone May 13, 2016


This comment has been minimized.

Copy link

commented May 13, 2016

I had this same pain recently but figured I was just doing something wrong. Glad I'm not alone.

josharian added a commit to josharian/go that referenced this issue May 13, 2016
cmd/go: add package path envvar when invoking toolexec command

For golang#15677

Change-Id: Ifced6a0397abe3a296e0cdbc432637f6afd8c127

This comment has been minimized.

Copy link

commented Oct 21, 2016


@rsc rsc added NeedsFix and removed NeedsDecision labels Oct 21, 2016

@rsc rsc modified the milestones: Go1.8Maybe, Go1.8 Nov 3, 2016

@rsc rsc modified the milestones: Go1.9, Go1.8Maybe Nov 11, 2016

@rsc rsc modified the milestones: Go1.10, Go1.9 Jun 22, 2017

@bradfitz bradfitz modified the milestones: Go1.10, Go1.11 Nov 28, 2017

@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Unplanned Jul 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
5 participants
You can’t perform that action at this time.