I am trying to install a go package from a local directory (basically I checked out and existing package and applied a pending pull request).
$ # Both commands give a similar output
$ go get -u file:///Users/me/workspaces/go/somepackage
$ go get -u /Users/me/workspaces/go/somepackage
unrecognized import path "[...]" (import path does not begin with hostname)
Since go get
is downloading then installing, I tried:
$ go install /Users/me/workspaces/go/somepackage
[] cannot import absolute path
Any experienced go user could give a hand?
If you just want to use a different branch (your PR branch), you can continue using the original import path.
cd $GOPATH/pkg/<package directory>
git checkout <PR branch>
go get -u <package>
If the package is available locally, go get update will just pull the latest code from the branch your local package is checked out to.