After installing the Go programming language from here, you will need to deal with the go command.
I’m not very good with golang, but I found some interesting issues for those who want to use go command with golang.
About go command can you read here and the go help output come with this help:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | go Go is a tool for managing Go source code. Usage: go command [arguments] The commands are: build compile packages and dependencies clean remove object files doc show documentation for package or symbol env print Go environment information bug start a bug report fix run go tool fix on packages fmt run gofmt on package sources generate generate Go files by processing source get download and install packages and dependencies install compile and install packages and dependencies list list packages run compile and run Go program test test packages tool run specified go tool version print Go version vet run go tool vet on packages Use "go help [command]" for more information about a command. Additional help topics: c calling between Go and C buildmode description of build modes filetype file types gopath GOPATH environment variable environment environment variables importpath import path syntax packages description of package lists testflag description of testing flags testfunc description of testing functions Use "go help [topic]" for more information about that topic. |
There are a few things you should know:
- don’t use
go list
to see packages, use this command:go list all
- take a look at installing go on the environment:
go env
- use help argument to get more help, like:
go help gopath , go help env
- see your go version for debug issues:
go version
- you can build your file (here called term_size.go) passing some gcflags :
go build -gcflags=-m term_size.go
# command-line-arguments
.\term_size.go:13:25: inlining call to termbox.Size
.\term_size.go:15:16: w escapes to heap
.\term_size.go:15:16: h escapes to heap
.\term_size.go:15:16: main ... argument does not escape - do not try this on Windows OS :
go build -ldflags
, first read more about:C:\Go\pkg\tool\windows_amd64\link.exe: -X flag requires argument of the form importpath.name=value
- the Windows shell doesn’t have single quoted strings:
go list -f "{{ .TestGoFiles }}" archive/tar
[reader_test.go strconv_test.go tar_test.go writer_test.go]