Discussing with @matloob, we were surprised that https://go.dev/doc/toolchain was the best (only?) canonical documentation we could find for the fact that //go:build go1.22 is not just a build constraint, but also affects the language version within that file.

We should make this more apparent in documentation, by including this information in (at least) go help buildconstraint. It may also be worth mentioning this in go.dev/ref/mod, or other go command documentation.

Comment From: gabyhelp

Similar Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

Comment From: findleyr

Helpful @gabyhelp.

Not yet closing as a dupe of #61894 (though it's very closely related), since this issue is about a specific go command help page. But feel free to close this if you'd prefer.

Comment From: gopherbot

Change https://go.dev/cl/595475 mentions this issue: cmd/go/internal/help: add documentation for language version downgrading