Skip to content

Commit

Permalink
Merge branch 'main' into conditionsonPodupdater
Browse files Browse the repository at this point in the history
  • Loading branch information
gizas authored Jan 15, 2024
2 parents c22d63a + d4f5d9f commit 082d99e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dev-tools/mage/gotool/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,19 @@ var Test goTest = runGoTest

// 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 workspace 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

0 comments on commit 082d99e

Please sign in to comment.