0

How do you run bazel gazelle update-repo command when you have private repository when your go.mod file has private repository in there

❯ bazel run //:gazelle -- update-repos -from_file=search/go.mod
INFO: Analyzed target //:gazelle (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:gazelle up-to-date:
  bazel-bin/gazelle-runner.bash
  bazel-bin/gazelle
INFO: Elapsed time: 0.231s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
go: bitbucket.org/blah/backend-components/go-logging@v1.0.5/go.mod: verifying module: bitbucket.org/blah/backend-components/go-logging@v1.0.5/go.mod: reading https://sum.golang.org/lookup/bitbucket.org/blah/backend-components/go-logging@v1.0.5: 410 Gone
        server response:
        not found: bitbucket.org/blah/backend-components/go-logging@v1.0.5: reading https://api.bitbucket.org/2.0/repositories/blah/backend-components?fields=scm: 403 Forbidden
                server response: Access denied. You must have write or admin access.
gazelle: exit status 1
Huy Le
  • 37
  • 6

1 Answers1

0

I can't find it in the docs how, but you set the environment variable GOPRIVATE to a comma-separated list of module-like patters. For example:

export GOPRIVATE='github.com/mycompany/myrepo,*.example.com'
JayEye
  • 457
  • 5
  • 15