Skip to content

cmd/compile,go/types: improve error messages when go version is too low  #51270

@feliixx

Description

@feliixx

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

go version go1.18rc1 linux/amd64

Does this issue reproduce with the latest release?

yes

What did you do?

Tried to play with generics after installing go 1.18 RC1, but was a little confused by the error message
when trying to use 1.18 feature like the any keyword because I totally forgot about the go version in go.mod.

./main.go:30:25: undeclared name: any (requires version go1.18 or later)

Mentioning go.mod in the error message would have helped fixing the error directly instead of having to re-check my config and search for this error message etc

What did you expect to see?

./main.go:30:25: undeclared name: any (requires version go1.18 or later, current min version in go.mod: go1.16)

What did you see instead?

./main.go:30:25: undeclared name: any (requires version go1.18 or later)

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions