The difference between go build and go install

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Go Build
With Go build plus the Go source file name to compile, we can get an executable file, by default the name of the file is the name of the source file removed. go suffix.

$ go Build hello.go$ Lshello hello.go

Of course we can also use the-o option to specify a different name:

$ go build-o mygo hello.go$ Lsmygo hello.go

If we execute the go build command directly in the Go-examples directory, followed by a file name, we will get an executable with the same name as the directory name:

$ go build$ lsgo-examples hello.go

Go Install
When compared to the build command, the install command installs the executable file or library file into the agreed directory after compiling the source code.

    • Go install compiles the executable file named after its directory name (DIR)

    • Go install installs the executable file in the bin directory with the SRC peer, and the bin directory is created automatically by go install

    • Go install compiles the various package that the executable depends on and places it in the PKG directory at the same level as the SRC

Resources:

Http://www.cnblogs.com/ghj1976/archive/2013/04/23/3038347.html


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.