What do you do with GOPATH?

I’m a bit confused by this solution. If it falls back to $HOME/go, then multiple projects share the $HOME/go folder even though they may have conflicting go versions.

This is my workaround, but it feels a bit hacky:

# Avoid sharing GOPATH with other projects.
PROJECT_NAME="$(basename "$PWD")"
export GOPATH="$HOME/.local/share/go-workspaces/$PROJECT_NAME"
1 Like