Disallow automatic go.mod/go.sum edits during build.
Section: Build Flags
Require clean mod files
bash
bash
go build -mod=readonly ./...Explanation
Disallow automatic go.mod/go.sum edits during build. Useful in Go CLI workflows.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Build Flags