Use the GOAUTH environment variable to configure authentication commands for Go module downloads. Set GOAUTH to a command that outputs HTTP headers containing your credentials, such as GOAUTH=git /path/to/repo to use Git credentials or GOAUTH=netrc to use your .netrc file. The Go toolchain will execute this command when fetching modules from private repositories and inject the returned headers into the request.
How to Implement GraphQL Authentication in Go
Configure Go module authentication by setting the GOAUTH environment variable to a credential command like git or netrc.