Tutorial by Examples

go run will run a program without creating an executable file. Mostly useful for development. run will only execute packages whose package name is main. To demonstrate, we will use a simple Hello World example main.go: package main import fmt func main() { fmt.Println("Hello, World...
go build will compile a program into an executable file. To demonstrate, we will use a simple Hello World example main.go: package main import fmt func main() { fmt.Println("Hello, World!") } Compile the program: go build main.go build creates an executable program...
go clean will clean up any temporary files created when invoking go build on a program. It will also clean files left over from Makefiles.
go fmt will format a program's source code in a neat, idiomatic way that is easy to read and understand. It is recommended that you use go fmt on any source before you submit it for public viewing or committing into a version control system, to make reading it easier. To format a file: go fmt main...
go get downloads the packages named by the import paths, along with their dependencies. It then installs the named packages, like 'go install'. Get also accepts build flags to control the installation. go get github.com/maknahar/phonecountry When checking out a new package, get creates the ta...
go env [var ...] prints go environment information. By default it prints all the information. $go env GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/vikashkv/work" ...

Page 1 of 1