Detailed explanation of go get command

Release: 2019-11-28 15:07:34
forward
8269 people have browsed it

Detailed explanation of go get command

go get

Download the package specified by the import path and its dependencies, and then install the named package, that is, execute the go install command. (Recommended: go language tutorial)

Usage: go get [-d] [-f] [-t] [-u] [-fix] [-insecure] [build flags ] [packages]

Tag Name Description
-d Let the command program only perform the download action and not the installation action.
-f is only valid when using the -u flag. This flag will cause the command program to ignore checking the import path of the downloaded code package. This is especially important if the code package you downloaded and installed belongs to a project that you forked from someone else.
-fix Let the command program perform corrective actions first after downloading the code package, and then compile and install it.
-insecure Allows the command program to use an insecure scheme (such as HTTP) to download the specified code package. If the code repository you use (such as the company's internal Gitlab) does not support HTTPS, you can add this tag. Please use it only when you are sure it is safe.
-t Let the command program download and install the dependent code packages in the test source code file in the specified code package at the same time.
-u Let the command use the network to update existing code packages and their dependent packages. By default, this command will only download code packages that do not exist locally from the network and will not update existing code packages.
-v Print out the name of the code package being built
-x Print out Commands used

go install

Use: go install [-i] [build flags] [packages].

is similar to the go build command. The go build command will compile the package and its dependencies, and the generated files will be stored in the current directory. Moreover, go build is only valid for the main package and does not work for other packages. For non-main packages, go install will generate static files and place them in the $GOPATH/pkg directory, with the file extension a. If it is the main package, an executable binary file with the same name as the given package will be generated under $GOPATH/bin.

To summarize: The go get command will download the specified package, compile the downloaded package, and then install it to a specific directory.

The above is the detailed content of Detailed explanation of go get command. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
go
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!