Created
May 31, 2017 22:40
-
-
Save andmetoo/707f1e3240af67c8ac6ab933f1613367 to your computer and use it in GitHub Desktop.
Golang setup in Mac OSX with HomeBrew + Fish.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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