[Go learning] go command notes

Synopsis

There are generally three main folders in the go project directory:

  • bin : The executable files (exe files) generated after compilation are generally stored here.

    The bin directory is generally set in environment variables, so it can be called directly.

  • src : Store the developed source code, generally code development is carried out in this directory.

  • pkg : store compiled library files

1. Basic common commands

go build

Compile the go program file to generate a binary executable (exe) file, which can be opened and run directly.

Compile the generated exe executable file

go run

Execute the go file directly, without generating the exe file in the middle.

go install

go install is divided into two steps:

  1. First compile an executable file (exe file)
  2. Copy the executable file to the GOPATH/bindirectory

Other commands

To be perfected~~

Guess you like

Origin blog.csdn.net/weixin_40849588/article/details/109278288