Skip to content

Instantly share code, notes, and snippets.

@andmetoo
Created May 31, 2017 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andmetoo/707f1e3240af67c8ac6ab933f1613367 to your computer and use it in GitHub Desktop.
Save andmetoo/707f1e3240af67c8ac6ab933f1613367 to your computer and use it in GitHub Desktop.
Golang setup in Mac OSX with HomeBrew + Fish.
# Create a GO workspace
# Create two sub directories into
# src/github.com/<user>/hello
# and bin/
#Update brew and install go + git
brew update
brew install go
brew install git
# GOLANG configurations in .config/fish/config.fish
set -x GOPATH $HOME/<Go_directory>
set -x GOROOT /usr/local/opt/go/libexec
set PATH $GOPATH/bin $GOROOT/bin $PATH
# test your setup
# inside the hello directory create a file named hello.go with the following contents:
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
# Then compile it with the go tool:
go install github.com/<user>/hello
# The above command will put an executable command named hello (or hello.exe) inside the bin directory of your workspace.
# Execute the command to see the greeting:
$GOPATH/bin/hello
# More informations https://golang.org/doc/install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment