You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Overview


Installation

brew install go

Configuration

Setup default workspace

mkdir ~/go
mkdir ~/go/src

Hello World Example


vi helloworld.go


package main
  
import (
  "fmt"
)

func main(){
  fmt.Println("Hello World")
}

Run it

go run helloworld.go

Commands

CommandDescription
go run <src.go>Run some code
go buildCompile the code. Outputs to local folder. Executable has folder as name.
go installCompiles and places the output in workspace/bin
go env GOPATHOutputs the default workspace folder




References

ReferenceURL
Learn Go in 12 Minuteshttps://www.youtube.com/watch?v=C8LgvuEBraI
Go Packageshttps://golang.org/pkg/




  • No labels