Search code examples
gitgovgo

Vgo and private repositories


I am trying to introduce vgo to some of our company projects for dependency management, but I've encountered some issues related to private repository.

Let's assume that we have following code structure:

go/src/companyName/projectA/

go/src/companyName/projectB/

go/src/companyName/projectC/

All three projects have different git repository and projectA imports projectB.

With normal go build approach, as long as we had those directories in place (under git), all worked fine, however we cant't make it work with vgo wrapper.

On vgo build following error is being thrown:

companyName/projectA/ cannot find module providing package companyName/projectB/

Which kind of make sense because with vgo get -v I can see that vgo tries to get meta tags from https://companyName which cannot be exposed for company policy.

What's the best way to tell to vgo to either use file system contents (if source files are already there) or to specity git repository for certain import paths?


Solution

  • One way of solving this is via the GOPROXY environment variable which can be set to a local file.

    export GOPROXY=file:///path/to/cache
    

    for more information, look at; https://github.com/golang/go/blob/master/src/cmd/go/testdata/mod/README