From 57ed899d0ce6ab78ad51cb83e67d2d9d32873eb2 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Thu, 10 Apr 2025 07:57:56 +0200 Subject: [PATCH] fix: add missing TypeCheck call (#1308) --- rule/unexported_return.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rule/unexported_return.go b/rule/unexported_return.go index 0d88a95..ab619a7 100644 --- a/rule/unexported_return.go +++ b/rule/unexported_return.go @@ -16,6 +16,8 @@ type UnexportedReturnRule struct{} func (*UnexportedReturnRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure { var failures []lint.Failure + file.Pkg.TypeCheck() + for _, decl := range file.AST.Decls { fn, ok := decl.(*ast.FuncDecl) if !ok { @@ -70,7 +72,7 @@ func (*UnexportedReturnRule) Name() string { // It is imprecise, and will err on the side of returning true, // such as for composite types. func exportedType(typ types.Type) bool { - switch t := typ.(type) { + switch t := types.Unalias(typ).(type) { case *types.Named: obj := t.Obj() switch {