Article From:

UseglideManagement dependence,GOPATHIf set toproject/vendorbutGOPATHLoadvendor/srcTo get something, andglideIs to install the code directlyvendorWhat should I do next?

Answer 0:

GOPATHTo remain unchanged, glide only relies on the project’s designation.vendorIt’s all.

Answer 1:

Look here my answer is very clear.

Answer 2:

GOPATHIs fixed, is an environment variable, you can write multiple paths in it, with a separator (Windows is a comma, Linux colon). When the library is loaded, a path will be found, and the finding will not continue to look down.

GOPATHHow should you match it?

vim /etc/profile.d/

export GOROOT=/app/go
export GOPATH=/home/jinhan/code
export GOBIN=$GOROOT/bin
export PATH=.:$PATH:/app/go/bin:$GOPATH/bin:/home/jinhan/software/Gogland-171.3780.106/bin

source /etc/profile.d/

andgo1.5Then (MAYBE) introduced the concept of vendor, a project will first find the library from the vendor of the project, and then fromGOPATHLook for it, and if there is a a library under this project, there is a B Library under the a library, a C library under the B library, and if the C library uses the D library, it will find the D library from the vendor under the C library, and can not find the bubble up to vendor…

glideThe project will package the third party library that is dependent on the main entrance of the project in vendor, which may lead to a conflict, if your project references the V library, the V library is wrapped in vendor, and your project is referenced by the w library as the third party library, and the w library will refer to the V library at this time.You import the structure variable of the V library into the function of your own library, and the parameters may not match.

I don’t know if you don’t understand it.GOLANGThe package management is like this

You can use it, toogodep….

Leave a Reply

Your email address will not be published. Required fields are marked *