rancher/trash

[Question] How to vendor main from 3rd party?

kron4eg opened this issue · 2 comments

I have dependency on other Go project's executable, in my case protoc-gen-go, I've vendored the library but as trash works it's just remove "main" go file since it's not imported anywhere in my project.

Currently I've created ./cmd/protoc-gen-go/main.go which is just a copy of github.com/golang/protobuf/protoc-gen-go/main.go but this seems very odd. Is there any other and better options?

Here's an approach I use, it's not ideal, but it's the cleanest hack I could come up with:

https://github.com/monax/cli/blob/master/install_vendor.sh

The idea is to restore specific paths that you want to keep by copying them in from Trash's cache of that repo (which will be at the appropriate version immediately after Trash has used it, obviously not concurrently safe, though you can use a custom trash cache location).

I've started to use golang/dep

required = [
    "github.com/golang/protobuf/protoc-gen-go",
    "gopkg.in/alanctgardner/gogen-avro.v4",
]

solved the problem :)