Go 1.25 adds the ignore directive to go.mod.
go.mod
It can be used to ignore directories:
ignore ( ./docker ./node_modules )
This sped up go mod tidy in one of my projects by more than 10x.
go mod tidy