GOROOT linked to old version after go update (cannot find GOROOT directory)

Hi *,

go was updated to version 1.16.5 these days, but my GOROOT seems still to be linked to the old version (1.16.4), therefore go tools do not work properly right now.

$ nixos-version 
21.05.1471.a7512bb64b1 (Okapi)

$ readlink $(which go)

$ go version
go: cannot find GOROOT directory: /nix/store/i68w5xd4kdj8mi1k7nhcxhmy27sf98z4-go-1.16.4/share/go

Is this a bug? How can I ‘reset’ the GOROOT path the NixOS way? I have collected garbage with nix-collect-grabage -d and rebuild with and without go - but it did not fix the issue so far. Anyone a hint how to fix this issue?

Many thanks,

Are you perhaps setting GOROOT env variable within your configuration?

What’s printenv GOROOT giving you?

printenv GOROOT is empty.

$ printenv GOROOT 

I also greped my $HOME with rg/fzf, no manuel entry found.

I fixed it, there was a env file in ~/.config/go containing this GOROOT path. Forgot to search with rg --hidden for the first time.

1 Like