diff options
| author | Taras Madan <tarasmadan@google.com> | 2024-09-10 12:34:20 +0200 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2024-09-10 14:05:26 +0000 |
| commit | 8c8b47c0c8cd80d1ff64780b9893d068439ead14 (patch) | |
| tree | 440a17d052b790f801e0d1063f1763fcc465127d /prog/prio.go | |
| parent | c97c816133b42257d0bcf1ee4bd178bb2a7a2b9e (diff) | |
all: follow new linter recommendations
Diffstat (limited to 'prog/prio.go')
| -rw-r--r-- | prog/prio.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/prog/prio.go b/prog/prio.go index ca4e11de4..142ad36b4 100644 --- a/prog/prio.go +++ b/prog/prio.go @@ -84,7 +84,7 @@ func (target *Target) calcResourceUsage() map[string]map[int]weights { switch a := t.(type) { case *ResourceType: if target.AuxResources[a.Desc.Name] { - noteUsage(uses, c, 1, ctx.Dir, "res%v", a.Desc.Name) + noteUsagef(uses, c, 1, ctx.Dir, "res%v", a.Desc.Name) } else { str := "res" for i, k := range a.Desc.Kind { @@ -98,20 +98,20 @@ func (target *Target) calcResourceUsage() map[string]map[int]weights { } case *PtrType: if _, ok := a.Elem.(*StructType); ok { - noteUsage(uses, c, 10, ctx.Dir, "ptrto-%v", a.Elem.Name()) + noteUsagef(uses, c, 10, ctx.Dir, "ptrto-%v", a.Elem.Name()) } if _, ok := a.Elem.(*UnionType); ok { - noteUsage(uses, c, 10, ctx.Dir, "ptrto-%v", a.Elem.Name()) + noteUsagef(uses, c, 10, ctx.Dir, "ptrto-%v", a.Elem.Name()) } if arr, ok := a.Elem.(*ArrayType); ok { - noteUsage(uses, c, 10, ctx.Dir, "ptrto-%v", arr.Elem.Name()) + noteUsagef(uses, c, 10, ctx.Dir, "ptrto-%v", arr.Elem.Name()) } case *BufferType: switch a.Kind { case BufferBlobRand, BufferBlobRange, BufferText, BufferCompressed: case BufferString, BufferGlob: if a.SubKind != "" { - noteUsage(uses, c, 2, ctx.Dir, fmt.Sprintf("str-%v", a.SubKind)) + noteUsagef(uses, c, 2, ctx.Dir, "str-%v", a.SubKind) } case BufferFilename: noteUsage(uses, c, 10, DirIn, "filename") @@ -137,7 +137,11 @@ type weights struct { inout int32 } -func noteUsage(uses map[string]map[int]weights, c *Syscall, weight int32, dir Dir, str string, args ...interface{}) { +func noteUsage(uses map[string]map[int]weights, c *Syscall, weight int32, dir Dir, str string) { + noteUsagef(uses, c, weight, dir, "%v", str) +} + +func noteUsagef(uses map[string]map[int]weights, c *Syscall, weight int32, dir Dir, str string, args ...interface{}) { id := fmt.Sprintf(str, args...) if uses[id] == nil { uses[id] = make(map[int]weights) |
