modules: Add GOAUTH to module config

Closes #13385
This commit is contained in:
Bjørn Erik Pedersen 2025-02-13 11:00:02 +01:00
parent d89b9d891c
commit 2c77719cd6
4 changed files with 83 additions and 19 deletions

View file

@ -216,3 +216,42 @@ func TestGetModlineSplitter(t *testing.T) {
gosumSplitter := getModlineSplitter(false)
c.Assert(gosumSplitter("github.com/BurntSushi/toml v0.3.1"), qt.DeepEquals, []string{"github.com/BurntSushi/toml", "v0.3.1"})
}
func TestClientConfigToEnv(t *testing.T) {
c := qt.New(t)
ccfg := ClientConfig{
WorkingDir: "/mywork",
CacheDir: "/mycache",
}
env := ccfg.toEnv()
c.Assert(env, qt.DeepEquals, []string{"PWD=/mywork", "GO111MODULE=on", "GOPATH=/mycache", "GOWORK=", filepath.FromSlash("GOCACHE=/mycache/pkg/mod")})
ccfg = ClientConfig{
WorkingDir: "/mywork",
CacheDir: "/mycache",
ModuleConfig: Config{
Proxy: "https://proxy.example.org",
Private: "myprivate",
NoProxy: "mynoproxy",
Workspace: "myworkspace",
Auth: "myauth",
},
}
env = ccfg.toEnv()
c.Assert(env, qt.DeepEquals, []string{
"PWD=/mywork",
"GO111MODULE=on",
"GOPATH=/mycache",
"GOWORK=myworkspace",
filepath.FromSlash("GOCACHE=/mycache/pkg/mod"),
"GOPROXY=https://proxy.example.org",
"GOPRIVATE=myprivate",
"GONOPROXY=mynoproxy",
"GOAUTH=myauth",
})
}