On Tue, Jul 5, 2016 at 7:24 PM, Sam Whited <s...@samwhited.com> wrote:
> On Tue, Jul 5, 2016 at 12:15 PM, Keith Rarick <k...@xph.us> wrote:
>> You don't have to vendor anything from your own repo, but you do have to
>> vendor everything from outside your repo. (To be precise, the distinction is
>> between inside and outside the directory containing the vendor directory.)
>
> In this case the repo's structure is:
>
> library/
>   library.go which imports "golang.org/x/net/trace"
>   cmd/
>     main.go which imports library (using an absolute import, no
> relative path hackery and "golang.org/x/net/trace")
>     vendor/
>       all external libraries (including golang.org/x/net/trace)
> required by main.go except "library"
>
> To be specific, it's https://github.com/jitsi/jap (I've removed the
> vendor/ dir temporarily though; browse back a commit or two).

As of today, if your binary vendors any other package, you need to
ensure that package doesn't have a vendor/ directory anywhere in the
source tree. Library maintainers can be good citizens by ensuring
their libraries don't vendor their dependencies; this is how the
jitsi/jap repo exists today, which is fine. But the responsibility is
ultimately on you; you can manually remove the vendor/ directory of
your vendored deps, or you can use a tool that does it automatically.

Exception to the rule: if a library vendors dependencies that don't
leak into the public API, and don't have potentially crashy func
inits, then it's OK to leave the vendor directory in place.

This is of course completely unsatisfying and I hope it will be
addressed by the core team as soon as possible.


>> Aside from that, make sure that the dependency in question is being imported
>> using the same import path by all the packages that need it. Not doing this
>> is probably the most common cause of having multiple copies of a package
>> linked in to your binary.
>
> The import path is the same, it's always "golang.org/x/net/trace".
>
> —Sam
>
>
> --
> Sam Whited
> pub 4096R/54083AE104EA7AD3
>
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to