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

go/build: Import seems to require absolute srcDir #14282

Open
griesemer opened this Issue Feb 10, 2016 · 11 comments

Comments

Projects
None yet
6 participants
@griesemer
Contributor

griesemer commented Feb 10, 2016

While investigating go/types issue #14215, I noticed that (after fixing the obvious go/types bug), build.Import didn't find the desired package if srcDir was relative. Computing its absolute path (relative to cwd) fixed the problem.

Reminder to investigate behavior. Fix and/or document.

@griesemer griesemer added this to the Go1.7 milestone Feb 10, 2016

@griesemer

This comment has been minimized.

Contributor

griesemer commented Feb 10, 2016

cc: @rsc

@griesemer

This comment has been minimized.

Contributor

griesemer commented Feb 10, 2016

If build.Import is changed/fixed such that it accepts a relative srcDir we can undo the changes to FindPkg (computing of absolute srcDir) in the following CLs:

http://golang.org/cl/19393
http://golang.org/cl/19394

@ianlancetaylor ianlancetaylor changed the title from build.Import seems to require absolute srcDir to go/build: Import seems to require absolute srcDir May 16, 2016

@rsc rsc modified the milestones: Go1.8, Go1.7 May 18, 2016

@rsc rsc modified the milestones: Go1.9Early, Go1.8 Oct 26, 2016

@griesemer

This comment has been minimized.

Contributor

griesemer commented Feb 24, 2017

Another CL to update if this gets addressed: http://golang.org/cl/37405/

@griesemer

This comment has been minimized.

Contributor

griesemer commented Feb 24, 2017

@rsc I'm going to assign this one to you (go/build issue); to decide and/or fix or document since you're most familiar with go/build.

I can take care of my CLs that contain the work-arounds.

@griesemer

This comment has been minimized.

Contributor

griesemer commented Feb 24, 2017

If the solution turns out to be that build.Import creates an absolute path from a relative srcDir, build.Context may need to also export a new function field AbsPath func(path string) (string, error) (to match the other virtual file system support). By default (function is nil), filepath.Abs would be used instead. As is, libraries using a build.Context cannot handle the case correctly where srcDir is relative and build.Context provides customized file system functions because the libraries can't know how they should implement AbsPath. (see go/internal/srcimporter)

@bradfitz bradfitz modified the milestones: Go1.9, Go1.9Early May 3, 2017

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

@rsc

This comment has been minimized.

Contributor

rsc commented Jun 15, 2017

I think we should fix it, for Go 1.10. Will send a CL.

@gopherbot

This comment has been minimized.

gopherbot commented Jun 15, 2017

CL https://golang.org/cl/45831 mentions this issue.

@rsc rsc added NeedsFix and removed NeedsDecision labels Jun 15, 2017

@rsc

This comment has been minimized.

Contributor

rsc commented Nov 22, 2017

Decided to hold off. go/build is basically going to be deprecated for this kind of use in another release or two.

@rsc rsc modified the milestones: Go1.10, Go1.11 Nov 22, 2017

@dominikh

This comment has been minimized.

Member

dominikh commented Nov 22, 2017

@rsc are there any written down plans on the package management changes, changes to go/build and so on that you have planned for future releases? This is probably something that tool authors want to know about way ahead of time.

@griesemer

This comment has been minimized.

Contributor

griesemer commented May 24, 2018

Things are in flux with vgo coming down the pike. Pushing this to next release, and perhaps at some point we can just close it as not relevant anymore.

@griesemer griesemer modified the milestones: Go1.11, Go1.12 May 24, 2018

@griesemer

This comment has been minimized.

Contributor

griesemer commented Oct 24, 2018

Moving to 1.13 where we may decide this doesn't matter anymore per #14282 (comment).

@griesemer griesemer modified the milestones: Go1.12, Go1.13 Oct 24, 2018

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