Skip to content

Commit

Permalink
feat: support types.Array as interface args
Browse files Browse the repository at this point in the history
  • Loading branch information
tomMoulard authored and traefiker committed May 2, 2024
1 parent ace0ca3 commit f242faa
Show file tree
Hide file tree
Showing 7 changed files with 1,020 additions and 8 deletions.
3 changes: 3 additions & 0 deletions mocktail.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ func getTypeImports(t types.Type) []string {
case *types.Slice:
return getTypeImports(v.Elem())

case *types.Array:
return getTypeImports(v.Elem())

case *types.Map:
imports := getTypeImports(v.Key())
imports = append(imports, getTypeImports(v.Elem())...)
Expand Down
3 changes: 3 additions & 0 deletions syrup.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,9 @@ func (s Syrup) getTypeName(t types.Type, last bool) string {
case *types.Chan:
return s.getChanTypeName(v)

case *types.Array:
return fmt.Sprintf("[%d]%s", v.Len(), s.getTypeName(v.Elem(), false))

default:
panic(fmt.Sprintf("OOPS %[1]T %[1]s", t))
}
Expand Down
Loading

0 comments on commit f242faa

Please sign in to comment.