File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 88 megacheckAPI "github.com/golangci/go-tools/cmd/megacheck"
99 "github.com/golangci/golangci-lint/pkg/lint/linter"
1010 "github.com/golangci/golangci-lint/pkg/result"
11+ "github.com/sirupsen/logrus"
1112)
1213
1314type Megacheck struct {
@@ -51,6 +52,17 @@ func (m Megacheck) Desc() string {
5152}
5253
5354func (m Megacheck ) Run (ctx context.Context , lintCtx * linter.Context ) ([]result.Issue , error ) {
55+ if len (lintCtx .NotCompilingPackages ) != 0 {
56+ var packages []string
57+ for _ , p := range lintCtx .NotCompilingPackages {
58+ packages = append (packages , p .String ())
59+ }
60+ logrus .Warnf ("Can't run megacheck because of compilation errors in packages " +
61+ "%s: run `typecheck` linter to see errors" , packages )
62+ // megacheck crashes if there are not compiling packages
63+ return nil , nil
64+ }
65+
5466 issues := megacheckAPI .Run (lintCtx .Program , lintCtx .LoaderConfig , lintCtx .SSAProgram ,
5567 m .StaticcheckEnabled , m .GosimpleEnabled , m .UnusedEnabled )
5668 if len (issues ) == 0 {
You can’t perform that action at this time.
0 commit comments