Tutorial by Examples

Place the following code into a file name hello.go: package main import "fmt" func main() { fmt.Println("Hello, 世界") } Playground When Go is installed correctly this program can be compiled and run like this: go run hello.go Output: Hello, 世界 Once you are...
Another example of "Hello World" style programs is FizzBuzz. This is one example of a FizzBuzz implementation. Very idiomatic Go in play here. package main // Simple fizzbuzz implementation import "fmt" func main() { for i := 1; i <= 100; i++ { s := &qu...
Environment variables that affect the go tool can be viewed via the go env [var ...] command: $ go env GOARCH="amd64" GOBIN="/home/yourname/bin" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/yourname&q...
If Go is not pre-installed in your system you can go to https://golang.org/dl/ and choose your platform to download and install Go. To set up a basic Go development environment, only a few of the many environment variables that affect the behavior of the go tool (See: Listing Go Environment Variabl...
For full documentation, run the command: godoc -http=:<port-number> For a tour of Go (highly recommended for beginners in the language): go tool tour The two commands above will start web-servers with documentation similar to what is found online here and here respectively. For quick ...
The Go Playground One little known Go tool is The Go Playground. If one wants to experiment with Go without downloading it, they can easily do so simply by . . . Visiting the Playground in their web browser Entering their code Clicking “Run” Sharing your code The Go Playground also has too...

Page 1 of 1