feat: models structs

This commit is contained in:
2024-12-29 23:48:18 +07:00
parent 9a66f2f2a7
commit a7f82bf8f2
7 changed files with 42 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
package nullSafetyCheck
package analyzers
import (
"go/ast"
@@ -8,8 +8,8 @@ import (
)
var NullSafetyAnalyzer = &analysis.Analyzer{
Name: "nullSafety",
Doc: "reports inconsistency of nullable values",
Name: "gormNullSafety",
Doc: "reports problems with nullable fields with unsatisfied tag",
Run: run,
}
@@ -24,6 +24,7 @@ func run(pass *analysis.Pass) (any, error) {
if !ok {
return true
}
pass.Fset.Position(structure.Pos())
if err := common.CheckUnnamedModel(*typeSpec); err != nil {
pass.Reportf(structure.Pos(), err.Error())