Skip to content

cmd/go: "go work use" doesn't clearly indicate when download fails #64007

Open
@lpar

Description

@lpar

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

1.20.3

Does this issue reproduce with the latest release?

Can't tell yet

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

darwin/arm64

What did you do?

I hit an error because go.mod had been updated to require v1.20.4, but go.work hadn't:

go: module . listed in go.work file requires go >= 1.21.4, but go.work lists go 1.21.3; to update it:
	go work use

So I tried that:

> go work use
go: go.mod requires go >= 1.21.4; switching to go1.21.4
go: downloading go1.21.4 (darwin/arm64)
go: download go1.21.4: golang.org/[email protected]: verifying module: checksum database disabled by GOSUMDB=off

My first issue is that I understood "go.work lists go 1.21.3; to update it: go work use" to mean that go work use would update go.work, and I'd then switch Go versions in the usual way (for me, using rtx). I didn't think "update it" meant "download and use go 1.21.4". So that message could use clarification.

My second issue is that Go seemed to have downloaded a different version of Go and presumably stored it somewhere. I didn't want an extra copy of Go 1.21.4 hanging around, so I set about trying to find it. After wasting quite a lot of time on that, I ran across this text in https://go.dev/doc/toolchain:

Instead, toolchain downloads fail for lack of verification if GOSUMDB=off.

So I think the second message, from go work use, could also use clarification. Specifically, if the download fails, it should clearly state that the download failed, rather than merely saying that the checksum database is disabled (which I know) and leaving the reader to work out what might have happened.

It'd also be good if Go checked to see if go work use was going to work (i.e. if GOSUMDB was enabled) before suggesting that the user run it.

(I also think it would be a good idea to have a better way to disable this auto-download-and-run functionality than having to turn off GOSUMDB. I don't want to keep an old version of Go around and have it download multiple newer versions as necessary. Rather, I want to continue to use a tool like rtx to manage my default Go install, so that when I run go to build a project I get the current version by default, even if that project doesn't require it.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BadErrorMessageIssues related compiler error messages that should be better.GoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions