Support projects with multiple go.mod files #68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
golangci-lint always searches the cwd upwards for the closest go.mod and .golangci.yaml file. This means that when linting a .go file, we can safely run golangci-lint from the directory in which the file is contained. In projects with a single go.mod in its root, golangci-lint will find it. In monorepos with a go.mod closer to the file under lint, golangci-lint will find it as well.
The rootDir prefix has to be stripped from the file, since otherwise it will not match the filename reported by golangci-lint.
This is a competing implementation to #66 and resolves #67.
I've commented on the other PR why I think that this approach is simpler and achieves the same thing