Go: cmd/go: do not update go.mod and go.sum with imports found in .gitignore

Created on 21 Nov 2020  路  6Comments  路  Source: golang/go

go.mod and go.sum should not be updated from paths found in .gitignore which may contain resources or experimental code.

GoCommand NeedsInvestigation

All 6 comments

I don't think the go tool should be aware of the Git specific .gitignore file.

See also #30058.

CC @bcmills @jayconrod

@seankhliao Can you elaborate your reaction?

Same as above, the go tool should not be aware of git ignore things and the dependencies for your experiments still need to be tracked somewhere

Well, this behavior can now be achieved by placing an empty go.mod file in that directory.

I agree with @ianlancetaylor and @seankhliao: the go command should not try to interpret vcs-specific files. Plus, we already have at least two mechanisms to ignore files: // +build ignore to ignore files, and dropping in a go.mod file to ignore directory subtrees. I don't see a pressing need for yet another.

Was this page helpful?
0 / 5 - 0 ratings