go run and
go build are not
What I did:
- I have done a go get of a package, it fetched it, and its dependencies, and build it. (all is good)
- I run its command-line example program. (all is good)
- I then created a new program based on this example, and
go runit. (all is good)
- Then copied this example program, and
go runit. ( get a dependency error ).
#↳ go version go version go1.11.4 linux/amd64 #↳ echo $GOPATH /home/????/+Files/workshops/programming/golang/gopath #↳ go get -u github.com/cbroglie/mustache/... #↳ cp -T $GOPATH/src/github.com/cbroglie/mustache/cmd/mustache/main.go my-mustache.go #↳ go build -v my-mustache.go my-mustache.go:8:2: cannot find package "github.com/spf13/cobra" in any of: /usr/local/go/src/github.com/spf13/cobra (from $GOROOT) /go/src/github.com/spf13/cobra (from $GOPATH)
I can see why it is not already installed: it was in a vendor sub-directory of the original source code. But why does it not install, when I build?