Skip to content

Commit 7f3abef

Browse files
committed
cgroups,generate,validat{e,ion}: fix golangci-lint deprecation warnings.
Signed-off-by: Krisztian Litkey <[email protected]>
1 parent 58c534d commit 7f3abef

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

cgroups/cgroups_v1.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ func (cg *CgroupV1) GetMemoryData(pid int, cgPath string) (*rspec.LinuxMemory, e
539539
return nil, err
540540
}
541541
kernelLimit := res
542-
lm.Kernel = &kernelLimit
542+
lm.Kernel = &kernelLimit //nolint:staticcheck // Ignore SA1019: lm.Kernel is deprecated
543543
case 4:
544544
res, err := strconv.ParseInt(strings.TrimSpace(string(contents)), 10, 64)
545545
if err != nil {

generate/generate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ func (g *Generator) SetLinuxResourcesMemorySwap(swap int64) {
917917
// SetLinuxResourcesMemoryKernel sets g.Config.Linux.Resources.Memory.Kernel.
918918
func (g *Generator) SetLinuxResourcesMemoryKernel(kernel int64) {
919919
g.initConfigLinuxResourcesMemory()
920-
g.Config.Linux.Resources.Memory.Kernel = &kernel
920+
g.Config.Linux.Resources.Memory.Kernel = &kernel //nolint:staticcheck // Ignore SA1019: g.Config.Linux.Resources.Memory.Kernel is deprecated
921921
}
922922

923923
// SetLinuxResourcesMemoryKernelTCP sets g.Config.Linux.Resources.Memory.KernelTCP.
@@ -1066,13 +1066,13 @@ func (g *Generator) ClearPreStartHooks() {
10661066
if g.Config == nil || g.Config.Hooks == nil {
10671067
return
10681068
}
1069-
g.Config.Hooks.Prestart = []rspec.Hook{}
1069+
g.Config.Hooks.Prestart = []rspec.Hook{} //nolint:staticcheck // Ignore SA1019: g.Config.Hooks.Prestart is deprecated
10701070
}
10711071

10721072
// AddPreStartHook add a prestart hook into g.Config.Hooks.Prestart.
10731073
func (g *Generator) AddPreStartHook(preStartHook rspec.Hook) {
10741074
g.initConfigHooks()
1075-
g.Config.Hooks.Prestart = append(g.Config.Hooks.Prestart, preStartHook)
1075+
g.Config.Hooks.Prestart = append(g.Config.Hooks.Prestart, preStartHook) //nolint:staticcheck // Ignore SA1019: g.Config.Hooks.Prestart is deprecated
10761076
}
10771077

10781078
// ClearPostStopHooks clear g.Config.Hooks.Poststop.

validate/validate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func (v *Validator) CheckHooks() (errs error) {
275275
}
276276

277277
if v.spec.Hooks != nil {
278-
errs = multierror.Append(errs, v.checkEventHooks("prestart", v.spec.Hooks.Prestart, v.HostSpecific))
278+
errs = multierror.Append(errs, v.checkEventHooks("prestart", v.spec.Hooks.Prestart, v.HostSpecific)) //nolint:staticcheck // Ignore SA1019: v.Spec.Hooks.Prestart is deprecated
279279
errs = multierror.Append(errs, v.checkEventHooks("poststart", v.spec.Hooks.Poststart, v.HostSpecific))
280280
errs = multierror.Append(errs, v.checkEventHooks("poststop", v.spec.Hooks.Poststop, v.HostSpecific))
281281
}

validation/util/linux_resources_memory.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ func ValidateLinuxResourcesMemory(config *rspec.Spec, t *tap.T, state *rspec.Sta
3131
t.Ok(*lm.Swap == *config.Linux.Resources.Memory.Swap, "memory swap is set correctly")
3232
t.Diagnosticf("expect: %d, actual: %d", *config.Linux.Resources.Memory.Swap, *lm.Reservation)
3333

34-
t.Ok(*lm.Kernel == *config.Linux.Resources.Memory.Kernel, "memory kernel is set correctly")
35-
t.Diagnosticf("expect: %d, actual: %d", *config.Linux.Resources.Memory.Kernel, *lm.Kernel)
34+
t.Ok(*lm.Kernel == *config.Linux.Resources.Memory.Kernel, "memory kernel is set correctly") //nolint:staticcheck // Ignore SA1019: lm.Kernel is deprecated
35+
t.Diagnosticf("expect: %d, actual: %d", *config.Linux.Resources.Memory.Kernel, *lm.Kernel) //nolint:staticcheck // Ignore SA1019: config.Linux.Resources.Memory.Kernel is deprecated
3636

3737
t.Ok(*lm.KernelTCP == *config.Linux.Resources.Memory.KernelTCP, "memory kernelTCP is set correctly")
38-
t.Diagnosticf("expect: %d, actual: %d", *config.Linux.Resources.Memory.KernelTCP, *lm.Kernel)
38+
t.Diagnosticf("expect: %d, actual: %d", *config.Linux.Resources.Memory.KernelTCP, *lm.Kernel) //nolint:staticcheck // Ignore SA1019: lm.Kernel is deprecated
3939

4040
t.Ok(*lm.Swappiness == *config.Linux.Resources.Memory.Swappiness, "memory swappiness is set correctly")
4141
t.Diagnosticf("expect: %d, actual: %d", *config.Linux.Resources.Memory.Swappiness, *lm.Swappiness)

0 commit comments

Comments
 (0)