@@ -14,6 +14,7 @@ const PROXY_PORT = "CODEQL_PROXY_PORT"
1414const PROXY_CA_CERTIFICATE = "CODEQL_PROXY_CA_CERTIFICATE"
1515const PROXY_URLS = "CODEQL_PROXY_URLS"
1616const GOPROXY_SERVER = "goproxy_server"
17+ const GIT_SOURCE = "git_source"
1718
1819type RegistryConfig struct {
1920 Type string `json:"type"`
@@ -29,6 +30,9 @@ var proxy_cert_file string
2930// An array of goproxy server URLs.
3031var goproxy_servers []string
3132
33+ // An array of Git URLs.
34+ var git_sources []string
35+
3236// Stores the environment variables that we wish to pass on to `go` commands.
3337var proxy_vars []string = nil
3438
@@ -92,18 +96,29 @@ func getEnvVars() []string {
9296 if cfg .Type == GOPROXY_SERVER {
9397 goproxy_servers = append (goproxy_servers , cfg .URL )
9498 slog .Info ("Found GOPROXY server" , slog .String ("url" , cfg .URL ))
99+ } else if cfg .Type == GIT_SOURCE {
100+ git_sources = append (git_sources , cfg .URL )
101+ slog .Info ("Found Git source" , slog .String ("url" , cfg .URL ))
95102 }
96103 }
97104
105+ goprivate := []string {}
106+
98107 if len (goproxy_servers ) > 0 {
99108 goproxy_val := "https://proxy.golang.org,direct"
100109
101110 for _ , url := range goproxy_servers {
102111 goproxy_val = url + "," + goproxy_val
103112 }
104113
105- result = append (result , fmt .Sprintf ("GOPROXY=%s" , goproxy_val ), "GOPRIVATE=" , " GONOPROXY=" )
114+ result = append (result , fmt .Sprintf ("GOPROXY=%s" , goproxy_val ), "GONOPROXY=" )
106115 }
116+
117+ if len (git_sources ) > 0 {
118+ goprivate = append (goprivate , git_sources ... )
119+ }
120+
121+ result = append (result , fmt .Sprintf ("GOPRIVATE=%s" , strings .Join (goprivate , "," )))
107122 }
108123 }
109124
0 commit comments