You've got Golang modules within a private repository or an organization and would like to go get
them.
For this example the GitHub organization will be spacely-sprockets
.
Set GOPRIVATE
(ideally placed in your .bashrc
/ dotfiles):
export GOPRIVATE="github.com/spacely-sprockets"
Update .gitconfig
:
$ git config --global \
url."ssh://[email protected]/spacely-sprockets".insteadOf \
"https://github.com/spacely-sprockets"
Will add a block like the following:
[url "ssh://[email protected]/spacely-sprockets"]
insteadOf = https://github.com/spacely-sprockets
And finally, lets test:
$ GO111MODULE="on" go get github.com/spacely-sprockets/widgets-golang
go: downloading github.com/spacely-sprockets/widgets-golang...