@@ -137,8 +137,9 @@ <h4 id="lazy-loading">Lazy module loading</h4>
137
137
<!-- TODO(bcmills): replace the design-doc link with proper documentation. -->
138
138
</ p >
139
139
140
- < p > <!-- golang.org/issue/45094 --> To facilitate the upgrade to lazy loading,
141
- the < code > go</ code > < code > mod</ code > < code > tidy</ code > subcommand now supports
140
+ < p > <!-- golang.org/issue/45094 -->
141
+ To facilitate the upgrade to lazy loading, the
142
+ < code > go</ code > < code > mod</ code > < code > tidy</ code > subcommand now supports
142
143
a < code > -go</ code > flag to set or change the < code > go</ code > version in
143
144
the < code > go.mod</ code > file. To enable lazy loading for an existing module
144
145
without changing the selected versions of its dependencies, run:
@@ -149,8 +150,32 @@ <h4 id="lazy-loading">Lazy module loading</h4>
149
150
</ pre >
150
151
151
152
< p > <!-- golang.org/issue/46141 -->
152
- TODO: Describe the < code > -compat</ code > flag
153
- for < code > go</ code > < code > mod</ code > < code > tidy</ code > .
153
+ By default, < code > go</ code > < code > mod</ code > < code > tidy</ code > verifies that
154
+ the selected versions of dependencies relevant to the main module are the same
155
+ versions that would be used by the prior Go release (Go 1.16 for a module that
156
+ spsecifies < code > go</ code > < code > 1.17</ code > ), and preserves
157
+ the < code > go.sum</ code > entries needed by that release even for dependencies
158
+ that are not normally needed by other commands.
159
+ </ p >
160
+
161
+ < p >
162
+ The < code > -compat</ code > flag allows that version to be overridden to support
163
+ older (or only newer) versions, up to the version specified by
164
+ the < code > go</ code > directive in the < code > go.mod</ code > file. To tidy
165
+ a < code > go</ code > < code > 1.17</ code > module for Go 1.17 only, without saving
166
+ checksums for (or checking for consistency with) Go 1.16:
167
+ </ p >
168
+
169
+ < pre >
170
+ go mod tidy -compat=1.17
171
+ </ pre >
172
+
173
+ < p >
174
+ Note that even if the main module is tidied with < code > -compat=1.17</ code > ,
175
+ users who < code > require</ code > the module from a
176
+ < code > go</ code > < code > 1.16</ code > or earlier module will still be able to
177
+ use it, provided that the packages use only compatible language and library
178
+ features.
154
179
</ p >
155
180
156
181
< h4 id ="module-deprecation-comments "> Module deprecation comments</ h4 >
0 commit comments