![]() You should therefore tell git how to access private packages by updating the git configuration git config -global url."ssh:// :acme-corporation".insteadOf "" Go mod uses git under the hood to retrieve remote package information. Make sure your git configuration is appropriate for private repositories The next step should therefore be as follows, which sets our private repository as “private” using the GOPRIVATE env variable go env -w GOPRIVATE=/acme-corporation/internal-rpc-clientģ. (in the syntax of Go's path.Match) of module path prefixes. The variable is a comma-separated list of glob patterns The go command considers to be private (not available publicly)Īnd should therefore not use the proxy or checksum database. The GOPRIVATE environment variable controls which modules These defaults work well for publicly available source code. To validating downloaded modules,regardless of source,Īgainst the public Go checksum database at. The go command defaults to downloading modules from the public The Go team has rightfully thought about the possiblity of having private packages when working with Go mod and created a help tool to describe such scenario go help module-private Add your organisation private repository to GOPRIVATE This is necessary for running the next steps. Make sure you are using Go modules correctly this tells Go to use Go modules in case you are running an old version or Go or you have disabled Go modules by mistake. ![]() How to resolve Go mod unknown revision when accessing private repositories 1. This means that Go modules can’t rightfully access a private package. If you have had a similar error you are not alone. ![]() Go: /acme-corporation/ : unknown revision v0.1.5 You might see an issue as follows: $ go build However when trying to import a Go package that is into a private repository you might encounter problems when running Go build or Go modules commands. When working on a Go project that uses the new Go modules package management and versioning system and working exclusively with public packages you won’t generally encounter any major issue. After the introduction of Go mod you may have worked with Go modules and private repositories.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |