Open eparis opened 8 years ago
We used to be able to do this via godep save github.com/onsi/ginkgo/ginkgo ./...
and use godep go install github.com/onsi/ginkgo/ginkgo
to DTRT. But with the vendor experiment that doesn't work.
We can vendor it in the same way (godep save github.com/onsi/ginkgo/ginkgo ./...
), but it needs to be installed a little differently:
go install github.com/hashicorp/terraform/vendor/github.com/onsi/ginkgo/ginkgo
.godep restore && go install github.com/onsi/ginkgo/ginkgo
(This touches the network though)So that provides 2 possible immediate work arounds.
Another possible solution is just manually copy github.com/onsi/ginkgo/ginkgo
into ginkgo/ginkgo
, godep save ./...
and install it with go install ./ginkgo/ginkgo
. That's not fun though.
Some thoughts (none of which I'm convinced are good or not):
godep install
command which could walk through Packages from Godeps.json and install the non local packages (or all of them). So you would then run godep install github.com/onsi/ginkgo/ginkgo
and that would shell out to go install github.com/hashicorp/terraform/vendor/github.com/onsi/ginkgo/ginkgo
.godep restore
to restore directly vendored files to $GOPATH w/o hitting the network, which would then let you go install github.com/onsi/ginkgo/ginkgo
.godep go
vendor aware and when it seems a target that it knows/thinks is in vendor it tries to DTRT and append the local package name + "vendor/" to the target. I'm afraid this may be fraught with errors and edge cases though.I'm open to suggestions on how to otherwise deal with this though.
A draw back to this is that you also need to always add github.com/onsi/ginkgo/ginkgo
to your godep save
pkg spec. I am considering having godep save
w/o any params just use what's in Godeps/Godeps.json
if it exists or default to .
(which is what it does now if you don't specify a pkg spec). Thoughts?
If you are using the vendor/
experiment and have vendored an external dep like ginkgo, you can install it along with everything else via go install ./...
. Since ./...
will consider everything (including mains) inside of vendor/
. See hashicorp/terraform#5291 for instance.
I would like to be able to import and entire
package main
into my Godeps but can not figure out how. I would like to be able to build/ship that versioned binary along with my binaries.More details:
v53- godep did a 'worse' job pruning unneeded code from Godeps than v54+. Kubernetes did not explicitly import
github.com/onsi/ginkgo/ginkgo
but in v53 it was getting imported into Godeps duringgodep save ./...
Kubernetes was in fact building that program out of godeps: https://github.com/kubernetes/kubernetes/blob/master/hack/lib/golang.sh#L88
When v54 came out it wasn't included by
godep save ./...
so now our build stopped working.I tried to create a fake/unused import, which tricked Godep into pulling it. But then stumbled upon another place in our code where we ran
godep install ./...
which actually tried to build my fake import and you aren't allowed to something inpackage main
.I'd like some way to get godep to include a specific import even though it isn't imported by my go code. So I can include the entire binary in my Godeps.