File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ type IllTypedError struct {
1515}
1616
1717func (e * IllTypedError ) Error () string {
18- return fmt .Sprintf ("errors in package: %v" , e .Pkg .Errors )
18+ return fmt .Sprintf ("IllTypedError: errors in package: %v" , e .Pkg .Errors )
1919}
2020
2121func BuildIssuesFromIllTypedError (errs []error , lintCtx * linter.Context ) ([]result.Issue , error ) {
Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ import (
2424
2525const unsafePkgName = "unsafe"
2626
27+ // https://github.com/golang/go/blob/go1.23.8/src/internal/types/errors/codes.go#L1484
28+ const tooNew = 151
29+
2730type loadingPackage struct {
2831 pkg * packages.Package
2932 imports map [string ]* loadingPackage
@@ -436,6 +439,14 @@ func (lp *loadingPackage) convertError(err error) []packages.Error {
436439
437440 case types.Error :
438441 // from type checker
442+
443+ // https://github.com/golang/go/blob/go1.23.8/src/go/types/api.go#L52-L57
444+ if int (reflect .ValueOf (err ).FieldByName ("go116code" ).Int ()) == tooNew {
445+ // https://github.com/golang/go/blob/go1.23.8/src/go/types/check.go#L380
446+ // https://github.com/golang/go/blob/go1.23.8/src/go/types/check.go#L349
447+ panic (err .Msg )
448+ }
449+
439450 errs = append (errs , packages.Error {
440451 Pos : err .Fset .Position (err .Pos ).String (),
441452 Msg : err .Msg ,
You can’t perform that action at this time.
0 commit comments