In a typical enterprise application project, it is common to split the code into several repositories, especially if the architecture used is microservice architecture. In more specific cases where the communication between components are using gRPC, there are generated gRPC client that usually invoked from another repo. Or there are core/common modules that should be reused from all repositories instead of duplicating.

In these cases, importing modules from another repo becomes a necessity. In an enterprise, the source code won’t be published on a public repository, but instead in a private repository, most likely with Github enterprise

Your code may then import package from another private repository like this:
grpcClient ""

The most common problem is to have this error when you try to build

go:[email protected]: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/fb3f4a78c344346ca1c63eb8160c9dd22cd33fe6a1c9a971c7487bd099500f29: exit status 128:
36 | fatal: could not read Username for '': terminal prompts disabled

This is because go will try to import packages from a private Github repo, which requires authentication.

The solution is to configure git to use an authentication whenever calling the private repo

git config --global url.https://[email protected]/.insteadOf

MY_TOKEN_HASH should be replaced with your own personal Github access token. To generate it, follow the steps here

Another command to execute is to set the GOPRIVATE environment variable. The GOPRIVATE environment variable controls which modules the go command considers to be private (not available publicly) and should therefore not use the proxy or checksum database
go env -w GOPRIVATE=""