Will snapd allow me to use an alternate location for $GOPATH?

Hi,

I recently installed the go snap from michael.hudson@ubuntu.com (id: Md1HBASHzP4i0bniScAjXGnOII9cEK6e) for doing some development work, and I was hoping to actually move my $GOPATH from $HOME/go to $HOME/development/go in an attempt to make the TLD of my $HOME a bit more tidy

Is this something the snap will observe? e.g. if I were to remove it and re-install it with a different $GOPATH, would it place $GOPATH/pkg/mod in $HOME/development/go instead?

Or is it hard-coded to $HOME/go?

Even better: is there some way I can move it without having to uninstall/reinstall? (assuming it will even observe my $GOPATH, that is…)

@mwhudson can perhaps answer this … (i also moved your post to the snap category since it is a packaging matter)

There’s nothing snap specific here I think? Just set GOPATH in your environment and the snapped Go binary will respect that. No need to reinstall (the Go snap doesn’t do anything at install time, fwiw).

Also worth mentioning the Go snap is packaged with classic confinement, so it has full access to your entire machine. Snaps being isolated to $HOME by default, and all the other quirks of having their own private data directories is only applicable to strict confinement snaps.