super-linter: Invoking golangci-lint run on individual files breaks linters in packages.
Describe the bug When golangci-lint is invoked against a single file, as it is here:
This fails to properly lint a package if types are defined in another file.
To Reproduce Steps to reproduce the behavior:
- Create two Go files, main.go and foo.go.
- Define
Fooin foo.go. - Run
golangci-lint runin that package, it lints fine. - Run the super-linter against that package, it fails to lint with:
ERROR:[level=warning msg="[runner] Can't run linter unused: buildssa: analysis skipped: errors in package: [/github/workspace/main.go:8:8: undeclared name: Foo]"
See an example run here: https://github.com/RussellRollins/super-lint-error/runs/785695971
Expected behavior This passes linting without failures.
Screenshots

Additional context I can see how the current solution is used to enable the “lint only changed files” feature, but this will fall down for relatively simple Go setups.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 19
- Comments: 26 (10 by maintainers)
Commits related to this issue
- Remove superlinter https://github.com/super-linter/super-linter/issues/143 — committed to pecigonzalo/loro by pecigonzalo a year ago
- Update go@1.20 (#93) * Update go@1.20 * Add pre-commit * Update segment/events@v2 * Fix version in Go action * Update deps * Fix LRU utilization for v2 * Update superlinter * Rem... — committed to pecigonzalo/loro by pecigonzalo a year ago
still not stale, but whatever, doesn’t look like it will get any attention
not stale
Still valid!
not stale
Not stale
still valid
not stale, although at this point I’m just going to unsubscribe from the issue.
Best of luck to anyone who still cares about this.