go build -mod=readonly disallows go.mod updates. It should also disallow go.sum updates. Maybe it already does; I haven't checked.