简体   繁体   中英

How to import a library with a special branch in Go

I am new for Go, and I am working on the project which need importing internal library. I can use go get to import it, and it works very well. So I noticed that running go get, it will import the master branch. However, I have a special case, that I need to import a dev branch instead of master branch. After doing some research, I tried go get libraryUrl@branchName, and it does not work for me. Any idea how to do it? Here is my go mod info

module projectName
go 1.15
require(
     github.com/satori/go.uuid v1.2.0
     internal libraryURL v0.01
)

Thank you for the help. And let me know if you need more info.

Thank to @blackgreen, who give me a link regarding this problem. I post here for someone who met the same problem as me. The conclusion is if go get libraryUrl@branchName doesn't work for you, set up the go env -w GO111MODULE=on. Then it shall work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM