@@ -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
@@ -98,18 +102,29 @@ func getEnvVars() []string {
98102 if cfg.Type == GOPROXY_SERVER {
99103 goproxy_servers = append(goproxy_servers, cfg.URL)
100104 slog.Info("Found GOPROXY server", slog.String("url", cfg.URL))
105+ } else if cfg.Type == GIT_SOURCE {
106+ git_sources = append(git_sources, cfg.URL)
107+ slog.Info("Found Git source", slog.String("url", cfg.URL))
101108 }
102109 }
103110
111+ goprivate := []string{}
112+
104113 if len(goproxy_servers) > 0 {
105114 goproxy_val := "https://proxy.golang.org,direct"
106115
107116 for _, url := range goproxy_servers {
108117 goproxy_val = url + "," + goproxy_val
109118 }
110119
111- result = append(result, fmt.Sprintf("GOPROXY=%s", goproxy_val), "GOPRIVATE=", " GONOPROXY=")
120+ result = append(result, fmt.Sprintf("GOPROXY=%s", goproxy_val), "GONOPROXY=")
112121 }
122+
123+ if len(git_sources) > 0 {
124+ goprivate = append(goprivate, git_sources...)
125+ }
126+
127+ result = append(result, fmt.Sprintf("GOPRIVATE=%s", strings.Join(goprivate, ",")))
113128 }
114129 }
115130
0 commit comments