I am interested in this problem too, especially dealing with 
golang.org/x/net/trace which is used by grpc which is used by multiple 
packages I import.

On Wednesday, March 7, 2018 at 10:03:37 PM UTC-8, Jay Guo wrote:
>
> Golang gurus,
>
> I'm currently trying to modularize my project with the help of Golang 
> plugin, and I come across this dependency vendoring dilemma.
>
> Let's say we have a project layout:
>
>    - Two different projects in separate repo: `Host` and `Guest`
>    - `Host` depends on package `pkgA`
>    - `Guest` depends on package `pkgA` too
>    - `Guest` is compiled as plugin, and loaded by `Host`
>    - `pkgA` is vendored into both `Host` and `Guest`
>
> In this situation, `pkgA` would be loaded twice and independently, meaning 
> there are two instance of the package in the program, one lives in `Guest` 
> and one in `Host`. init() would be called twice as well
>
> Particularly, I'm dealing with golang.org/x/net/trace package, which 
> actually registers an endpoint /debug/requests. The second attempt would 
> panic because of double-registration.
>
> I'd appreciate any advice on how to manage common dependencies of plugin 
> and main project, thank you!
>
> - J
>

-- 
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