working with open-source Go modules is more straightforward, you add them in Go mod files and run Go mod commands and it just works.
Recently, I came across private Go modules usage in one of my projects at work and thought of writing about it so it can help someone :)
if you have only one repo then you can do
If you have more than one private module, you can run the following:
If you are using the SSH key to connect to Github, you will have to add the following snippet in
[url "ssh://email@example.com/"] insteadOf = https://github.com/
once everything is set,
go get -u github.com/yourorg/yourrepo
if you want to pull a specific package, you can do,
go get -u github.com/yourrepo/yourorg/yourdir
Happy Coding !!!