diff --git a/internal/astutils/ast_utils.go b/internal/astutils/ast_utils.go index bcd13d8d1..0a346043a 100644 --- a/internal/astutils/ast_utils.go +++ b/internal/astutils/ast_utils.go @@ -2,7 +2,6 @@ package astutils import ( - "fmt" "go/ast" ) @@ -73,7 +72,11 @@ func getFieldTypeName(typ ast.Expr) string { return "*" + getFieldTypeName(f.X) case *ast.IndexExpr: return getFieldTypeName(f.X) + "[" + getFieldTypeName(f.Index) + "]" + case *ast.ArrayType: + return "[]" + getFieldTypeName(f.Elt) + case *ast.InterfaceType: + return "interface{}" default: - panic(fmt.Sprintf("not supported type %T", typ)) + return "UNHANDLED_TYPE" } } diff --git a/testdata/golint/sort.go b/testdata/golint/sort.go index e4e5c985f..e82057a3e 100644 --- a/testdata/golint/sort.go +++ b/testdata/golint/sort.go @@ -44,3 +44,12 @@ func (x X) Less(i *pkg.tip) (result bool) { return len(x) } // MATCH /exported m // Test for issue #1217 func (s *synchronized[T]) Swap(other Synchronized[T]) {} + +// Swap for issue #1228 +func (s *synchronized[T]) Swap(other interface{}) {} + +// Swap for issue #1228 +func (s *synchronized[T]) Swap(other []int) {} + +// Swap for issue #1228 +func (s *synchronized[T]) Swap(other []interface{}) {}