The GoLang, Go, or Go Language, is a very nice language used by many projects. Started by Google, they asked some smart people from Berkely (and other places) to create a language that could be simple to write and build like C for compatability to other architectures.
Using https://play.golang.org/ to quickly share code and ask questions. Allows people to execute the code in quick mannor and within a shared environment.
I like to stay away from global installs of my tools and this is another one of those projects that lets you install multiple versions and select the one for your project.
I really like to use shell scripts to take care of all my setups. So, I am going to tell you (as well as myself) to use the LibSh Project file called go.sh which should have a utility to do installation. Currently the function is called
go_install_goenv which gives you the ability to select Go versions.
After you have this installed
LibSh should pick it up and load it and give you the necessary settings for your environment to continue working.
Here are a couple of things to check your environment is good to Go (see what I did there? yah that was a pun on purpose…)
- Checking what Go can see
This is the command that will dump a ton of things, but of the output we are looking for GOPATH and GOROOT. These variables will need to point to the same version you want to use. If they do not line up, then set with
goenv local #.#.# to set your version for the project, or use
goenv global #.#.# to set globally.
# set version in .go-version goenv local 1.15.7 # check version go version # output should be: # go version go1.15.7 darwin/amd64 # # check go env go env | grep -E "PATH|ROOT" # output should be: GOPATH="/Users/addlema/go/1.15.7" GOROOT="/Users/addlema/.goenv/versions/1.15.7"