If instead of using go get to install a library, I want to clone the repository locally to use it, what would I have to do?
My GOPATH is /home/reik/go
Just putting the cloned repository into my /home/reik/go and then going inside /home/reik/go/hep/ where hep is the name of the repository, and executing go build doesn’t work.
[reik@reik-msi hep]$ go build
can't load package: package hep: code in directory /home/reik/go/src/hep expects import "go-hep.org/x/hep"
Neither does go get
[reik@reik-msi hep]$ go get
go get: warning: modules disabled by GO111MODULE=auto in GOPATH/src;
ignoring go.mod;
see 'go help modules'
can't load package: package hep: code in directory /home/reik/go/src/hep expects import "go-hep.org/x/hep"
Looking at the go-hep.org/x/hep import, does this mean this library cannot be built locally?
So… does /your_project_name/vendor/ have to be in my GOPATH?
For example in this case,
the core package is in GOPATH/src/go-hep.org/x/hep, so would the package with my local changes be in GOPATH/src/go-hep.org/x/hep/vendor/hep?
Using go build in the root directory of the package? In this case GOPATH/src/go-hep.org/x/hep?
In your example, could your_project_name and other_package_name be the same? I mean… they are the same package. your_project_name being installed via go-get and other_package_name being the same package saved locally.
Yes, could be the same although is better to keep things clear. Perhaps the name of the project should be different from the names of other packages. In my opinion is no reason to have two different things with the same name.