![]() ![]() Go mod tidy will prune go.sum and go.mod by removing the unnecessary checksums and transitive dependencies (e.g. In your project it results in 12 lines because those are the bare minimum to match the source code. Go mod tidy makes sure go.mod matches the source code in the module. Go get will also add to the go.mod file the require directives for dependencies that were just updated. When using modules, all expands to all packages in the main module and their dependencies, including dependencies needed by tests of any of those. Go get -u all updates everything including test dependencies from Package List and Patterns will update everything that is rooted in. will expand to all packages rooted in the current directory, which effectively also updates everything (all modules that provide those packages).įollowing from the above, go get -u. ![]() In typical projects, running this in the module root is enough, as it likely imports everything else. ) updates the package in the current directory, hence the module that provides that package, and its dependencies to the newer minor or patch releases when available. It's a common misconception that dependencies will shrink after go mod tidy: tracking go.sum, in some cases this file will grow after a tidy (though, not in this case) Go mod tidy cleans up this aggressive dependency analysis. So there may be a valid reason the repo maintainer fixes at a particular (non-latest) version. These dependencies may grow even further if you tried this tomorrow (the latest version of some sub-dependency adds new functionality, so it needs new dependencies). Also, the mere fact of updating dependencies to their latest (compatible) version, may in & of itself pull in new direct/indirect dependencies. Go get -u on it's own is more aggressive in pulling in dependencies. If the maintainer had, then you would see the 13 line version you see at the end. Using your example, commit d24acdbf of git:///walles/moar most likely was checked in by the maintainer without running go mod tidy (explaining the longer 19 lines). The inconsistencies you are seeing is due to the inherent organic nature of software. And to recursively update packages in any subdirectories: go get -u. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |