Skip to content
Open
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
4 changes: 3 additions & 1 deletion dev-tools/mage/gotool/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ var Test goTest = runGoTest

// GetModuleName returns the name of the module.
func GetModuleName() (string, error) {
lines, err := getLines(callGo(nil, "list", "-m"))
// `go list -buildvcs=false -f '{{.Module}}'` produces the same output as `go list -m`
// and it works with go workspace
lines, err := getLines(callGo(nil, "list", "-buildvcs=false", "-f", "{{.Module}}"))
Copy link
Contributor

@ycombinator ycombinator May 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need -buildvcs=false here? AFAICT it's not an option supported by go list. It looks like that option is only supported by go build. Also, running just go list -f {{.Module}} seems to work.

Suggested change
lines, err := getLines(callGo(nil, "list", "-buildvcs=false", "-f", "{{.Module}}"))
lines, err := getLines(callGo(nil, "list", "-f", "{{.Module}}"))

if err != nil {
return "", err
}
Expand Down