After go 1.17, use go install to install the module

wedge

According to experience, we know that go get can be used to install modules, and modules are divided into two categories, one is ordinary code dependencies, and the other is executable binary tools. The two types of modules are placed in different folders, the first type of code dependencies are usually placed in the $GOPATH/pkg/modfolder, and the second type of modules are usually placed $GOPATH/binin the path.

Today, when I used the go get command to install the binary tool according to the tutorial, although it was prompted that the installation was complete, the actual use kept saying that the command was not found. Check the path, and there is no $GOPATH/binpackage just installed. I guess the installation failed.

resolution process

Then guess whether you need to use go install to install the module. After trying it, it is successful. It seems that you need to use the go install command to install the binary toolkit after go 1.17, but you can still use the command to install the module of the code-dependent class go get.

by the way

Upgrade the module package version, go get -u xxxorgo install -u xxx

Guess you like

Origin blog.csdn.net/qq_41767116/article/details/131346893