'Global GOPRIVATE setting in Goland
Is there any way to have the Goland inherit the global environment for the go get command? We have lots of private packages and projects on a self-hosted git and we need to have them work with the same GOPRIVATE settings. Unfortunately Goland works with it's completely separated env vars for each project and I can't find any workarounds.
Solution 1:[1]
You can specify GOPRIVATE variable for GoLand globally via File | New Projects Setup | Preferences/Settings for New Projects | Go | Go modules | Environment.
Solution 2:[2]
This is the command you are looking for. You can set it in the makefile or build. Also instead of exporting via bash you can use this command. This sets it global. To test make another go project after setting it and run: go env
go env -w GOPRIVATE=hq-stash.yourcorp.net
//After Setting make project else where and test
go env
//output:
GOOS="darwin"
GOPATH="/Users/you/.go"
GOPRIVATE="hq-stash.yourcorp.net"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | s0xzwasd |
| Solution 2 |
