Skip to content

10. Go commands

Tanveer Alam edited this page Aug 23, 2019 · 1 revision

Go tool chain

gofmt -w hello.go # -w option updates the file(s) in place

go run main.go

go build main.go

go install main.go

go build -o main go_3_compiling_running_code.go

GOOS=linux go build -o main.linux go_3_compiling_running_code.go

GOOS=windows go build -o main.exe go_3_compiling_running_code.go

$ file main main.linux main.exe
main:       ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
main.linux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
main.exe:   PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows

go get -u github.com/golang/protobuf/proto // Downloads and install

go doc fmt

godoc fmt

go doc fmt Println

Clone this wiki locally