3 ms·
Thanks. Now I get a console full of: thing.go:10:2: cannot find package "whatever/thing/frob" in any of: /usr/lib/go-1.7/src/whatever/thing/frob (from $GO
by ctz 10y ago
Thanks. Now I get a console full of:
thing.go:10:2: cannot find package "whatever/thing/frob" in any of:
/usr/lib/go-1.7/src/whatever/thing/frob (from $GOROOT)
($GOPATH not set)
So I go looking for GOPATH documentation, and it tells me I need to put all my source dependencies in one directory. That's unlike everything else on the planet, but OK. I do that, and set GOPATH=~/go.
Now:
thing.go:10:2: cannot find package "whatever/thing/frob" in any of:
/usr/lib/go-1.7/src/whatever/thing/frob (from $GOROOT)
/home/ctz/go/src/whatever/thing/frob (from $GOROOT)
($GOPATH not set)
OK, so do I need to set GOPATH as well?
thing.go:4:2: cannot find package "bytes" in any of:
/home/ctz/go/src/bytes (from $GOROOT)
($GOPATH not set)
thing.go:8:2: cannot find package "container/list" in any of:
/home/ctz/go/src/container/list (from $GOROOT)
($GOPATH not set)
That seems worse.
Now somebody teaches me about 'go get'. Great!
package whatever/thing/frob: unrecognized import path "whatever/thing/frob" (import path does not begin with hostname)
(To be clear, I now can build all the golang code I want. This post is more indicative of my experience getting started a few years ago. In my opinion, GOPATH is a terrible design decision.)
- blablabla123 10y agoYou can check in your dependencies into vendors/, in case they are so complex. However it's recommended to only have few dependencies. Yes, you need to install your deps separately. (If the maintainer decides not to use vendors/ and not check it into git) With C, the classic ./configure && make && make install also expects you to install your dependencies manually. Using Go you have a canonical way to do it. Also if you don't plan to hack on it, it's probably a got idea to go with binary packages. If there are none, the tool is probably not exactly meant for production anyway.