Skip to content

cmd/go: improve error message from empty "mod tidy" #51551

@leitzler

Description

@leitzler

What version of Go are you using (go version)?

$ go version
go version devel go1.19-dbbe4cca5d Tue Mar 8 21:35:38 2022 +0000 darwin/amd64

Does this issue reproduce with the latest release?

At least on tip.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
N/A

What did you do?

$ go mod init foo
go: creating new go.mod: module foo
$ go mod tidy
go: warning: "all" matched no packages

What did you expect to see?

An error message that doesn't mention all, since I didn't specify all anywhere. I understand why I do get this error message but it might be confusing in other cases.

I stumbled upon this when I accidentally ran go mod init twice where the second run explicitly asks me to:

go: to add module requirements and sums:
        go mod tidy

What did you see instead?

go: warning: "all" matched no packages

Metadata

Metadata

Assignees

No one assigned

    Labels

    GoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions