아쉽게 이진트리 뒤집기를 못해서 구글에서 떨어진 Max Howell 님의 brew 를 사용해서 설치합니다.
$ brew install go
In just a few minutes, go should be all installed and you should be almost ready to code.However we need to do two small things before we start: 9.1.1 Setup your paths By convention, all your Go code and the code you will import, will live inside a workspace.This convention might seem rigid at first, but it quickly becomes clear that such a convention (like most Go conventions) makes our life much easier. Before starting, we need to tell Go, where we want our workspace to be, in other words, where our code will live. Let’s create a folder named “go” in our home directory and set our environment to use this location.
gopath를 만들어야 한다.
gopath 를 설정해준다.
사용하는 shell에 %PATH 에도 추가해준다.
$ mkdir $HOME/go
$ export GOPATH=$HOME/go
Note that if we open a new tab or restart our machine, Go won’t know where to find our workspace. For that, you need to set the export in your profile:
$ open $HOME/.bash_profile
Add a new entry to set GOPATH and add the workspace’s bin folder to your system path:
ohmyzsh 를 사용할경우 .zshrc 에 추가해준다.
This will allow your Go workspace to always be set and will allow you to call the binaries you compiled. Official resource
Max Howell님 이야기는 너무 유명해서 그냥 농담.