Working with private repos in Go can be a pain in the you-know-what. In this video, I show you two techniques for soothing that pain.
Notes:
1. Set GOPRIVATE
Full description: https://goproxy.io/docs/GOPRIVATE-env.html
export GOPRIVATE=github.com/flimzy/private
- or -
go env -w GOPRIVATE=github.com/flimzy/private
2. Configure git to fetch via SSH instead of HTTP(S):
git config --global url."[email protected]:flimzy/private".insteadOf "https://github.com/flimzy/private"
- or -
edit ~/.gitconfig manually
3. Configure .netrc with an API key for HTTPS authentication
Futher reading on the topic:
How to use private GitLab subgroup with go get: https://stackoverflow.com/a/57099566/13860