What is the different between go mod download
and go mod tidy
?
When I run go mod tidy
, if the import is not found it also downloads it.
What is the different between go mod download
and go mod tidy
?
When I run go mod tidy
, if the import is not found it also downloads it.
go mod download
is downloading all of the modules in the dependency graph, which it can determine from reading only the go.mod files. It doesn't know which of those modules are actually needed to satisfy a build, so it doesn't pull in the checksums for those modules (because they may not be relevant).
On the other hand, go mod tidy
has to walk the package graph in order to ensure that all imports are satisfied. So it knows, for a fact, without doing any extra work, that the modules it walks through are needed for a go build in some configuration.
© 2022 - 2024 — McMap. All rights reserved.