Skip to content

cmd/go: inconsistent reporting of default Go version #70090

Open
@rsc

Description

@rsc

In the transcript below, there is no go line in the go.mod.
Builds say I can't use post-Go 1.16 features, but then when I say
"go get [email protected]" (using a sufficiently old version so as not to break any users),
it claims I am downgrading from Go 1.24.

% go install
# rsc.io/tmp/jsonfmt
./jsonfmt.go:95:9: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)
% cat go.mod
module rsc.io/tmp/jsonfmt
% go get [email protected]
go: downgraded go 1.24 => 1.21.0
go: added toolchain go1.24
% cat go.mod
module rsc.io/tmp/jsonfmt

go 1.21.0

toolchain go1.24
% 

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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions