2.6 Golang command

In the command line go command to view the Go language commands:

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 and cached files
    doc         show documentation for package or symbol
    env         print Go environment information
    bug         start a bug report
    fix         update packages to use new APIs
    fmt         gofmt (reformat) 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         report likely mistakes in packages

Use "go help [command]" for more information about a command.

Additional help topics:

    c           calling between Go and C
    buildmode   build modes
    cache       build and test caching
    filetype    file types
    gopath      GOPATH environment variable
    environment environment variables
    importpath  import path syntax
    packages    package lists
    testflag    testing flags
    testfunc    testing functions

Use "go help [topic]" for more information about that topic.

Practical command

godoc -http=:8888    本地启动一个go官网
也可以
go doc fmt.printf 直接在本地查看函数表准用法

go env environmental information for print Go language.

go run command can compile and run the command source files.

go get according to requirements and can be downloaded from the Internet or the actual situation update the specified code package and dependencies, and they build and install.

go build command is used to compile our source code file, or specify the code package as well as their dependencies.

go install compiled and installed for the specified code packets and their dependencies.

go clean command will delete some files and directories created when executing other commands.

go doc commands can be attached to print documents on the Go programming language entity. We can program the identifier of the entity to achieve the purpose of the document to view it as a parameter to the command.

go test command to the Go programming language for testing.

The role of go list command is to list the information specified code package.

Go all language source code files go fix package will specify the code in the old version of the code for the new revised version of the code.

go vet is a simple tool for checking the Go language source code static error.

go tool pprof command to access interactive content profile.

Guess you like

Origin www.cnblogs.com/open-yang/p/11256727.html