eben
eben

Reputation: 41

golang "matched no packages" error with absolute path, fine with relative path

I have a tree of golang code. I am using golang 1.5.1 on a Mac (OS X 10.11). I can successfully build my code with the following command with relative paths on the command line.

go install ./...

But, if I use an absolute path, I get an error message. E.g.,

go install `pwd`/...]

warning: "/Users/eben/src/cbq-gui/src/github.com/couchbaselabs/cbq-gui/..." matched no packages

That seems pretty odd, since "." and `pwd` should evaluate to the same thing. What am I missing? Thanks.

Upvotes: 3

Views: 22105

Answers (2)

Siyaram Malav
Siyaram Malav

Reputation: 4718

You need to run go installation command in your $GOPATH("/Users/eben/src/cbq-gui/") with go mod.

$ GO111MODULE=on go get -u github.com/couchbaselabs/cbq-gui/...

I hope this helps.

Upvotes: 1

captncraig
captncraig

Reputation: 23118

pwd will use the full absolute path, but the go tool expects paths relative to $gopath.

What you really want is go install github.com/couchbaselabs/cbq-gui/... most likely. Assuming your gopath is set to /Users/eben/src/cbq-gui which is a bit odd to me.

Most people use a single gopath for all their projects.

Upvotes: 6

Related Questions