From 0fb3e2c18408cc8ff6cb87962fc13f2684d1df96 Mon Sep 17 00:00:00 2001
From: "Bryan C. Mills"
To facilitate the upgrade to lazy loading,
- the go
mod
tidy
subcommand now supports
+
+ To facilitate the upgrade to lazy loading, the
+ go
mod
tidy
subcommand now supports
a -go
flag to set or change the go
version in
the go.mod
file. To enable lazy loading for an existing module
without changing the selected versions of its dependencies, run:
@@ -149,8 +150,32 @@ Do not send CLs removing the interior tags from such phrases.
- TODO: Describe the -compat
flag
- for go
mod
tidy
.
+ By default, go
mod
tidy
verifies that
+ the selected versions of dependencies relevant to the main module are the same
+ versions that would be used by the prior Go release (Go 1.16 for a module that
+ spsecifies go
1.17
), and preserves
+ the go.sum
entries needed by that release even for dependencies
+ that are not normally needed by other commands.
+
+ The -compat
flag allows that version to be overridden to support
+ older (or only newer) versions, up to the version specified by
+ the go
directive in the go.mod
file. To tidy
+ a go
1.17
module for Go 1.17 only, without saving
+ checksums for (or checking for consistency with) Go 1.16:
+
+ go mod tidy -compat=1.17 ++ +
+ Note that even if the main module is tidied with -compat=1.17
,
+ users who require
the module from a
+ go
1.16
or earlier module will still be able to
+ use it, provided that the packages use only compatible language and library
+ features.