Go – Using the go command .

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:

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]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.