Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing private Go module: unknown revision error

Tags:

git

github

go

I have a private Go repo at https://github.com/myorg/myrepo that is used by another Go repo and defined in go.mod.

When I try to run $ go mod tidy to download all the dependencies, it returns me the following error:

go: github.com/myorg/[email protected]: reading github.com/myorg/myrepo/go.mod at revision v0.10.1: unknown revision v0.10.1

The same thing happens when I try to "go get" this module.

What have I tried so far?

  • Set my git config to use SSH: git config --global [email protected]:.insteadOf https://github.com/
  • Set the GOPRIVATE env var: export GOPRIVATE=github.com/myorg/* Refer: https://stackoverflow.com/a/27501039/4927751

I have been stuck with this for a day now and would highly appreciate if someone can suggest me ways to fix this.

like image 579
Kshitij Saraogi Avatar asked Jul 27 '26 14:07

Kshitij Saraogi


1 Answers

Finally resolved this thanks to a colleague.

Issue: Local module caching in Go - not sure how its managed internally by the go tool.

Solution:

  1. Delete the ($GOPATH)/pkg/mod/cache repo.
  2. Reinstall the dependencies.
like image 91
Kshitij Saraogi Avatar answered Jul 29 '26 05:07

Kshitij Saraogi