Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Go Workspaces when executing 'go list' in agent packaging process #4039

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions dev-tools/mage/gotool/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,18 @@

// GetModuleName returns the name of the module.
func GetModuleName() (string, error) {
lines, err := getLines(callGo(nil, "list", "-m"))
lines, err := getLines(callGo(
// Disabling the Go workspaces prevents 'go list' from listing all
// modules within the workspace.
map[string]string{"GOWORK": "off"},
"list",
"-m"))
if err != nil {
return "", err
}
if len(lines) != 1 {
return "", fmt.Errorf("unexpected number of lines")
return "", fmt.Errorf("expected 'go list -m' to return 1 line, got %d",
len(lines))
}
return lines[0], nil
}
Expand Down Expand Up @@ -204,7 +210,7 @@
}, cmd, args)
}

func runGo(cmd string, args *Args) error {

Check failure on line 213 in dev-tools/mage/gotool/go.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

func `runGo` is unused (unused)
return execGoWith(sh.RunWith, cmd, args)
}

Expand Down
Loading