From 5a6e1e18f97a1c7e354f1bd3e5580d2f70a19026 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 11 Feb 2026 12:18:58 -0800 Subject: [PATCH 1/2] Preallocate some slices Fix *some* of the prealloc linter warnings. While it does not make sense to address all warnings (or add prealloc to the list of linters we run in CI), some do make sense. Signed-off-by: Kir Kolyshkin --- events.go | 2 +- libcontainer/internal/userns/usernsfd_linux.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/events.go b/events.go index 53e8c028f..28d324984 100644 --- a/events.go +++ b/events.go @@ -199,7 +199,7 @@ func convertMemoryEntry(c cgroups.MemoryData) types.MemoryEntry { } func convertBlkioEntry(c []cgroups.BlkioStatEntry) []types.BlkioEntry { - var out []types.BlkioEntry + out := make([]types.BlkioEntry, 0, len(c)) for _, e := range c { out = append(out, types.BlkioEntry(e)) } diff --git a/libcontainer/internal/userns/usernsfd_linux.go b/libcontainer/internal/userns/usernsfd_linux.go index a1151a3fb..35ac373cd 100644 --- a/libcontainer/internal/userns/usernsfd_linux.go +++ b/libcontainer/internal/userns/usernsfd_linux.go @@ -41,10 +41,11 @@ func (m Mapping) toSys() (uids, gids []syscall.SysProcIDMap) { // the uid and gid mappings (because the order doesn't matter to the kernel). // The set of userns handles is indexed using this ID. func (m Mapping) id() string { - var uids, gids []string + uids := make([]string, 0, len(m.UIDMappings)) for _, idmap := range m.UIDMappings { uids = append(uids, fmt.Sprintf("%d:%d:%d", idmap.ContainerID, idmap.HostID, idmap.Size)) } + gids := make([]string, 0, len(m.GIDMappings)) for _, idmap := range m.GIDMappings { gids = append(gids, fmt.Sprintf("%d:%d:%d", idmap.ContainerID, idmap.HostID, idmap.Size)) } From 61a1d1b3aaf3ed7f9868bc9cd8bec3f86d619e35 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 11 Feb 2026 12:21:07 -0800 Subject: [PATCH 2/2] ci: bump golangci-lint to v2.10 Signed-off-by: Kir Kolyshkin --- .github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index ab8c4e253..9b2b37284 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -41,7 +41,7 @@ jobs: sudo apt -qy install libseccomp-dev - uses: golangci/golangci-lint-action@v9 with: - version: v2.6 + version: v2.10 skip-cache: true # Extra linters, only checking new code from a pull request to main. - name: lint-extra