In a large, multi developer, project I worked on we used gb 
<https://getgb.io/>. It was a "large executable" style project, with may 
local sub packages that were intended to provide code organization, not to 
be reused by other projects. In addition to vendoring support, using gb 
<https://getgb.io/> makes each project a completely independent go 
universe. You can git clone any version of your source to any location on 
your hard drive, `cd` there, and it will build. You don't need to change 
any enthronement variable or anything ... just `cd` and build. All of *your 
*packages go right under */src* and the vendored ones go under */vendor/src*. 
Your packages can even have simple paths like* /src/myapp*.

This essentially accomplishes what you are looking for, albeit in a pretty 
heavy handed way. A few things to note:
* We made the decision to use gb <https://getgb.io/> before go had built in 
vendoring support. I'm not sure what its future look like now. 
* Gb requires you to vendor *all *your dependencies. I would only go this 
route if that sounds like a win, rather than a hassle. 
* If you need to run a go tool that gb doers not support, it is possible to 
do so by carefully constructing your GOPATH.


On Thursday, November 16, 2017 at 3:10:13 AM UTC-5, Ally Dale wrote:
>
> Hi all,
> I was confused that why golang do not support referencing local package.
> eg: import "./local2" //error: local import "./local2" in non-local package
> I have upload a test project here:
> https://github.com/vipally/localpackage
>
> Here is my trouble:
> My project path is: github.com/vipally/localpackage The local package 
> reference relation is: main <- local2 <- local1 In "main.go" use such to 
> reference local package local2: import "
> github.com/VIPALLY/localpackage/local2" Someone who forked this projcet 
> as "github.com/someone/localpackage". But how can his project working by 
> avoid following change? import "github.com/SOMEONE/localpackage/local2"
>
> Here maybe one solution:
> 1. use package comment to specify root of local project in projcetroot
> package main // import "#" 
> 2. use someway to reference local package
> import "#/local2"
>
> REFERENCE: https://github.com/vipally/localpackage 
>
> Thanks for reading!
> Ally
>

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