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

runtime: add GOPATH() string #19451

Closed
willfaught opened this issue Mar 8, 2017 · 7 comments

Comments

Projects
None yet
3 participants
@willfaught
Copy link
Contributor

commented Mar 8, 2017

Since Go v1.8 no longer requires setting GOPATH, does it make sense to add a GOPATH() string function to runtime, like there is for GOROOT?

@bradfitz

This comment has been minimized.

Copy link
Member

commented Mar 8, 2017

Note that:

  • the runtime knows nothing about $GOPATH. The concept of GOPATH is a cmd/go, go/types.Importer thing.
  • GOPATH is multi-valued, so GOPATH() string is the wrong signature.
@bradfitz

This comment has been minimized.

Copy link
Member

commented Mar 8, 2017

Oh, it even says that at the top of the runtime package docs:

The GOARCH, GOOS, GOPATH, and GOROOT environment variables complete the set of Go environment variables. They influence the building of Go programs (see https://golang.org/cmd/go and https://golang.org/pkg/go/build). GOARCH, GOOS, and GOROOT are recorded at compile time and made available by constants or functions in this package, but they do not influence the execution of the run-time system.

What are you trying to do? Does build.Default.Import (https://golang.org/pkg/go/build/#Context.Import) solve your problem?

@willfaught

This comment has been minimized.

Copy link
Contributor Author

commented Mar 8, 2017

@bradfitz

This comment has been minimized.

Copy link
Member

commented Mar 8, 2017

Okay, sounds like go/build and friends are what you're looking for then.

This isn't something we want to add to the runtime package, since it's not a runtime thing.

@bradfitz bradfitz closed this Mar 8, 2017

@willfaught

This comment has been minimized.

Copy link
Contributor Author

commented Mar 8, 2017

@bradfitz

This comment has been minimized.

Copy link
Member

commented Mar 8, 2017

Perhaps. But any historical mistakes are locked-in at this point.

@willfaught

This comment has been minimized.

Copy link
Contributor Author

commented Mar 8, 2017

@golang golang locked and limited conversation to collaborators Mar 8, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.