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

go: stop setting GOPATH #87758

Closed
wants to merge 1 commit into from
Closed

go: stop setting GOPATH #87758

wants to merge 1 commit into from

Conversation

mmlb
Copy link
Contributor

@mmlb mmlb commented May 13, 2020

Motivation for this change

The compiler does not need it anymore, has not needed it for many years
iirc. This just goes in and pollutes the environment overriding the users
GOPATH and causing grief.

Go even warns about it itself, without vs with this commit:

~> go env GOPATH
/home/manny/go
~> nix-shell -p go
~> go env GOPATH
warning: GOPATH set to GOROOT (/nix/store/gvw1mfpdrk7i82884yhxf9lf5j3c12zm-go-1.14.1/share/go) has no effect
/nix/store/gvw1mfpdrk7i82884yhxf9lf5j3c12zm-go-1.14.1/share/go
~> exit
~> nix-shell -I nixpkgs=cloned/NixOS/nixpkgs -p go
~> go env GOPATH
/home/manny/go
~> exit

https://discourse.nixos.org/t/what-do-you-do-with-gopath/7113

Things done

Removed setup-hook.sh which was only being used to add GOPATH to the env.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

cc @cstrahan @orivej @Mic92 @rvolosatovs @kalbasit @Frostman

The compiler does not need it anymore, has not needed it for many years
iirc. This just goes in and pollutes the environment overriding the
users GOPATH and causing grief.

Go even warns about it itself, without vs with this commit:

```sh
~> go env GOPATH
/home/manny/go
~> nix-shell -p go
~> go env GOPATH
warning: GOPATH set to GOROOT (/nix/store/gvw1mfpdrk7i82884yhxf9lf5j3c12zm-go-1.14.1/share/go) has no effect
/nix/store/gvw1mfpdrk7i82884yhxf9lf5j3c12zm-go-1.14.1/share/go
~> exit
~> nix-shell -I nixpkgs=cloned/NixOS/nixpkgs -p go
~> go env GOPATH
/home/manny/go
~> exit
```
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/what-do-you-do-with-gopath/7113/4

@Mic92
Copy link
Member

Mic92 commented May 13, 2020

Yeah that was only useful in the early days of go.

@Mic92
Copy link
Member

Mic92 commented May 13, 2020

cherry-picked in 399572ed5aeeba21a0df8719c63d6fc5b6e884c3

@Mic92 Mic92 closed this May 13, 2020
@ofborg ofborg bot requested a review from Frostman May 13, 2020 21:44
@zowoq
Copy link
Contributor

zowoq commented May 13, 2020

@Mic92 399572e doesn't seem to be on a branch?

@Mic92
Copy link
Member

Mic92 commented May 13, 2020

Now it is: a1e13f6

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

Successfully merging this pull request may close these issues.

None yet

6 participants