DEV Community

Alex Rios
Alex Rios

Posted on • Updated on

Using private Golang libs

1 - Configure GIT (~/.gitconfig)

[url "ssh://git@github.com/"]
    insteadOf = https://github.com/
Enter fullscreen mode Exit fullscreen mode

2 - Add the private repository location in GOPRIVATE env var

go env -w GOPRIVATE="github.com/<org>/<project>"
Enter fullscreen mode Exit fullscreen mode

2.1 - You can add a whole organization accepting all projects with *

go env -w GOPRIVATE="github.com/<org>/*"
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
gbrezende profile image
Guilherme Rezende • Edited

you can use '*' to work with all org projects

go env -w GOPRIVATE="github.com/<org>/*"

Collapse
 
alextrending profile image
Alex Rios

Indeed! Thanks Guilherme. I'm adding the note.