Created
January 24, 2015 00:34
-
-
Save giwa/8870c62e990a6cea9455 to your computer and use it in GitHub Desktop.
Go by Example: Hello World ref: http://qiita.com/giwa@github/items/02a3a0eb01800bda62ee
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
brew update | |
brew install go |
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
export GOROOT=/usr/local/opt/go/libexec | |
export GOPATH=$HOME/go | |
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH |
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
package main | |
import "fmt" | |
func main() { | |
fmt.Println("hello world") | |
} | |
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
$ go run hello-world.go | |
hello world | |
$ go build hello-world.go | |
$ ls | |
hello-world hello-world.go | |
$./hello-world | |
hello world | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment