_content/blog/range-functions: suggest go get over go mod edit
Using 'go mod edit -go=1.23' is equivalent to editing the go directive in go.mod, and nothing more. This doesn't pay attention to the rest of go.mod content and may leave the module in an untidy state. Prior to Go 1.21, 'go mod tidy -go=1.23' was the suggested way to do the update while also maintaining the tidy state of the module. That form is still valid, but the simpler go get go@1.23 is now preferred¹. The 'go get go@1.n' syntax is newer and not everyone has seen it yet, so keep the 'go mod edit' mention with a hint as to how they differ. ¹ https://go.dev/doc/toolchain#get, second last paragraph Change-Id: I5c8c5568e1512fec4de28e666a6b80be98290647 Reviewed-on: https://go-review.googlesource.com/c/website/+/607036 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Родитель
f83945bcdf
Коммит
f05993b178
|
@ -787,8 +787,9 @@ specific to range over function types.
|
|||
As range over function types is new in the Go 1.23 release, using it
|
||||
requires specifying at least Go language version 1.23.
|
||||
|
||||
There are (at least) three ways to set the language version:
|
||||
- On the command line, run `go mod edit -go=1.23`
|
||||
There are (at least) four ways to set the language version:
|
||||
- On the command line, run `go get go@1.23` (or `go mod edit -go=1.23`
|
||||
to only edit the `go` directive).
|
||||
- Manually edit the `go.mod` file and change the `go` line.
|
||||
- Keep the older language version for the module as a whole, but use a
|
||||
`//go:build go1.23` build tag to permit using range over function
|
||||
|
|
Загрузка…
Ссылка в новой задаче