feat: references check

... and fixes: parse fields without tags and other logical errors
This commit is contained in:
2024-12-30 21:15:15 +07:00
parent d4ef9b3ec6
commit 49878c333c
8 changed files with 196 additions and 76 deletions

21
common/resolveBaseType.go Normal file
View File

@@ -0,0 +1,21 @@
package common
import (
"go/ast"
)
func ResolveBaseType(expr ast.Expr) *string {
switch e := expr.(type) {
case *ast.Ident:
return &e.Name
case *ast.StarExpr:
return ResolveBaseType(e.X)
case *ast.ArrayType:
return ResolveBaseType(e.Elt)
case *ast.SelectorExpr:
return ResolveBaseType(e.X)
case *ast.ParenExpr:
return ResolveBaseType(e.X)
}
return nil
}