简体   繁体   中英

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.

You can specify GOPRIVATE variable for GoLand globally via File |New Projects Setup | Preferences/Settings for New Projects | Go | Go modules | Environment .

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM