Skip to content

Commit 73cdfc9

Browse files
committed
Fix module detection bugs within golangci-lint invocation
Signed-off-by: Thomas Stromberg <[email protected]>
1 parent e42d924 commit 73cdfc9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lint-install.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,12 @@ func goLintCmd(root string, level string) string {
186186
suffix = " || true"
187187
}
188188

189-
if len(found) == 1 && found[0] == root {
189+
klog.Infof("found %d modules within %s: %s", len(found), root, found)
190+
if len(found) == 0 || (len(found) == 1 && found[0] == strings.Trim(root, "/")) {
190191
return fmt.Sprintf("out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH) run%s", suffix)
191192
}
192193

193-
return fmt.Sprintf(`find . -name go.mod | xargs -n1 dirname | xargs -n1 -I{} sh -c "cd {} && golangci-lint run -c $(GOLINT_CONFIG)"%s`, suffix)
194+
return fmt.Sprintf(`find . -name go.mod | xargs -n1 dirname | xargs -n1 -I{} sh -c "cd {} && out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH) run -c $(GOLINT_CONFIG)"%s`, suffix)
194195
}
195196

196197
// shellLintCmd returns the appropriate shell lint command for a project.

0 commit comments

Comments
 (0)