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
Closed

runtime: add GOPATH() string #19451

willfaught opened this issue Mar 8, 2017 · 7 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@willfaught
Copy link
Contributor

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
Copy link
Contributor

bradfitz 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
Copy link
Contributor

bradfitz 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?

@bradfitz bradfitz added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 8, 2017
@willfaught
Copy link
Contributor Author

willfaught commented Mar 8, 2017 via email

@bradfitz
Copy link
Contributor

bradfitz 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 as completed Mar 8, 2017
@willfaught
Copy link
Contributor Author

willfaught commented Mar 8, 2017 via email

@bradfitz
Copy link
Contributor

bradfitz commented Mar 8, 2017

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

@willfaught
Copy link
Contributor Author

willfaught commented Mar 8, 2017 via email

@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.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants