go mod edit

Edit and format go.mod files

Options

NameDescription
-moduleChange the module's path
-go <version>Set the expected Go language version
-require <path>Add a requirement on the given module
-droprequire <path>Drop a requirement on the given module
-exclude <path>Add an exclusion on the given module
-dropexclude <path>Drop an exclusion on the given module
-replace <path>Add a replacement of the given module path and version pair
-dropreplace <path>Drops a replacement of the given module path and version pair
-retract <version>Add a retraction for the given version
-dropretract <version>Drop a retraction for the given version
-fmtFormat the go.mod file without making other changes
-printPrint the final go.mod in its text format instead of writing it back to disk
-jsonPrint the final go.mod in JSON format instead of writing it back to disk in text forma