go build can't find a revision

Issue

I developed a repo on computer A and created a go.mod/go.sum that I checked in.

I pull that repo with the go.mod/go.sum files on computer B, but when I try to build the program, the module constraints can’t be satisfied.

$ go build
go: finding github.ibm.com/kms/key-protect-client v0.1.5
go: finding golang.org/x/tools v0.0.0-20180221164845-07fd8470d635
go: github.ibm.com/kms/key-protect-client@v0.1.5: unknown revision v0.1.5
go: error loading module requirements

The repo that is failing is a private repo, and for some reason it doesn’t get downloaded to the module cache. On another computer, the dependencies are downloaded and the build succeeds. I am building another private repo in that same domain, so I know that my github credentials give me access to these repos. But for some reason, the go module system can’t get to the dependent repo.

I cannot find more information how to debug this.

Solution

Problem is related to cmd/go not being aware of git identities and assuming there is only one articulated in the .gitconfig file.

Work-around: have a set of git identities ready to replace global .gitconfig when you need to work with that git identity and are dealing with cmd/go tools that update the module file.

Answered By – Ravenwater

Answer Checked By – Candace Johnson (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.