aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS1
-rw-r--r--pkg/compiler/check.go12
2 files changed, 9 insertions, 4 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 3eb1319e8..f83b508b2 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -72,6 +72,7 @@ Mark Johnston
Intel Corporation
Pengfei Xu
Yanting Jiang
+ Igor Chervatyuk
NVIDIA Corporation & Affiliates
Noa Osherovich
Jason Gunthorpe
diff --git a/pkg/compiler/check.go b/pkg/compiler/check.go
index 103b69eb5..5345e2e3f 100644
--- a/pkg/compiler/check.go
+++ b/pkg/compiler/check.go
@@ -959,25 +959,29 @@ func (comp *compiler) checkStructRecursion(checked map[string]bool, n *ast.Struc
Struct: name,
Field: f.Name.Name,
})
- comp.recurseField(checked, f.Type, path)
+ comp.recurseField(checked, f.Type, path, false)
path = path[:len(path)-1]
}
checked[name] = true
}
-func (comp *compiler) recurseField(checked map[string]bool, t *ast.Type, path []pathElem) {
+func (comp *compiler) recurseField(checked map[string]bool, t *ast.Type, path []pathElem, isArg bool) {
desc := comp.getTypeDesc(t)
if desc == typeStruct {
comp.checkStructRecursion(checked, comp.structs[t.Ident], path)
return
}
- _, args, base := comp.getArgsBase(t, false)
+ _, args, base := comp.getArgsBase(t, isArg)
if desc == typePtr && base.IsOptional {
return // optional pointers prune recursion
}
for i, arg := range args {
if desc.Args[i].Type == typeArgType {
- comp.recurseField(checked, arg, path)
+ isArg := false
+ if t.Ident == "fmt" {
+ isArg = true
+ }
+ comp.recurseField(checked, arg, path, isArg)
}
}
}