On Tue, 5 Jul 2016 10:05:27 -0500 Sam Whited <s...@samwhited.com> wrote:
> I'm running into a problem with the trace package; I'm trying to build > an application that has a vendored version of it, and one of the > modifications I've made imports a library that also uses the trace > package. > > As I've complained about on the issue tracker before, the trace > package registers some handlers implicitly in init() which in my mind > is extremely bad behavior. However, since I've got a vendored version > in my application, and one of the libraries I import also imports > trace (and Go has no way of telling that these are the same package), > the init() function gets called twice, tries to register the handler > twice, and causes a panic. > > Is there some way around this that I'm not thinking of (other than not > vendoring trace, or also vendoring the other library that imports > trace, which feels poor given that it's actually in the same repo as > the application)? AFAIK, vendoring explicitly implements an all-or-nothing approach: you're supposed to resolve transitive dependencies yourself, and vendor them all. Basically that «Go has no way of telling that these are the same package» is a part of the design of the Go toolchain: the package to use is defined solely by its import path. -- 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.