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

Update dev-tools to support Go Workspace #124

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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