diff options
| author | Taras Madan <tarasmadan@google.com> | 2025-07-15 16:43:33 +0200 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2025-07-17 08:31:25 +0000 |
| commit | abd11cfd08430ec5f9d2c6dbd0e0f798816922d1 (patch) | |
| tree | 522a8cc072d07d85c8a1d37b5b3ab89483599b48 /pkg/compiler | |
| parent | a81f309b57265e5760b926274e1f1681e7550e41 (diff) | |
all: apply linter auto fixes
./tools/syz-env bin/golangci-lint run ./... --fix
Diffstat (limited to 'pkg/compiler')
| -rw-r--r-- | pkg/compiler/check.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/pkg/compiler/check.go b/pkg/compiler/check.go index bd3489ccc..121e7386a 100644 --- a/pkg/compiler/check.go +++ b/pkg/compiler/check.go @@ -393,7 +393,8 @@ func (comp *compiler) checkRequiredCallAttrs(call *ast.Call, callAttrNames map[s } } - if desc == typeStruct { + switch desc { + case typeStruct: s := comp.structs[t.Ident] // Prune recursion, can happen even on correct tree via opt pointers. if checked[s.Name.Name] { @@ -404,10 +405,10 @@ func (comp *compiler) checkRequiredCallAttrs(call *ast.Call, callAttrNames map[s for _, fld := range fields { comp.checkRequiredCallAttrs(call, callAttrNames, fld.Type, checked) } - } else if desc == typeArray { + case typeArray: typ := t.Args[0] comp.checkRequiredCallAttrs(call, callAttrNames, typ, checked) - } else if desc == typePtr { + case typePtr: typ := t.Args[1] comp.checkRequiredCallAttrs(call, callAttrNames, typ, checked) } @@ -502,9 +503,10 @@ func (comp *compiler) checkFieldPathsRec(t0, t *ast.Type, parents []parentDesc, _, args, _ := comp.getArgsBase(t, isArg) for i, arg := range args { argDesc := desc.Args[i] - if argDesc.Type == typeArgLenTarget { + switch argDesc.Type { + case typeArgLenTarget: comp.validateFieldPath(arg, t0, t, parents, warned) - } else if argDesc.Type == typeArgType { + case typeArgType: comp.checkFieldPathsRec(t0, arg, parents, checked, warned, argDesc.IsArg) } } @@ -1548,13 +1550,14 @@ func (comp *compiler) checkDupConstsCall(n *ast.Call, dups map[string]map[string constArgID := "" for i, arg := range n.Args { desc := comp.getTypeDesc(arg.Type) - if desc == typeConst { + switch desc { + case typeConst: v := arg.Type.Args[0].Value if v != 0 && v != 18446744073709551516 { // AT_FDCWD constArgID += fmt.Sprintf("(%v-%v)", i, fmt.Sprintf("%v", v)) hasConsts = true } - } else if desc == typeResource { + case typeResource: constArgID += fmt.Sprintf("(%v-%v)", i, arg.Type.Ident) } } |
