From ad03222d87859c3e543405cd14c50c5784028fa9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 13 Jan 2026 08:59:29 +0000 Subject: [PATCH 1/2] chore(deps): update golangci/golangci-lint docker tag to v2.8.0 | datasource | package | from | to | | ---------- | ---------------------- | ------ | ------ | | docker | golangci/golangci-lint | v2.7.2 | v2.8.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Taskfile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index 40c041e1..e6ce6d36 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -21,7 +21,7 @@ tasks: # renovate: datasource=git-refs depName=golangci-lint lookupName=https://github.com/sagikazarmark/daggerverse currentValue=main DAGGER_GOLANGCI_LINT_SHA: 6133ad18e131b891d4723b8e25d69f5de077b472 # renovate: datasource=docker depName=golangci/golangci-lint versioning=semver - GOLANGCI_LINT_VERSION: v2.7.2 + GOLANGCI_LINT_VERSION: v2.8.0 cmds: - > GITHUB_REF= dagger -sc "github.com/sagikazarmark/daggerverse/golangci-lint@${DAGGER_GOLANGCI_LINT_SHA} From b6c2c2f18953a0d36b03a4b946791485a40f1fa6 Mon Sep 17 00:00:00 2001 From: Marco Nenciarini Date: Tue, 13 Jan 2026 22:09:47 +0100 Subject: [PATCH 2/2] fix(lint): preallocate envs slice to avoid reallocations The golangci-lint v2.8.0 upgrade introduced a prealloc linter finding suggesting to preallocate the envs slice with capacity 5 + len(config.env) to avoid reallocations when appending config.env elements. Signed-off-by: Marco Nenciarini --- internal/cnpgi/operator/lifecycle.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/cnpgi/operator/lifecycle.go b/internal/cnpgi/operator/lifecycle.go index 43c8ee89..8a0bbb50 100644 --- a/internal/cnpgi/operator/lifecycle.go +++ b/internal/cnpgi/operator/lifecycle.go @@ -353,30 +353,31 @@ func reconcilePodSpec( sidecarTemplate corev1.Container, config sidecarConfiguration, ) error { - envs := []corev1.EnvVar{ - { + envs := make([]corev1.EnvVar, 0, 5+len(config.env)) + envs = append(envs, + corev1.EnvVar{ Name: "NAMESPACE", Value: cluster.Namespace, }, - { + corev1.EnvVar{ Name: "CLUSTER_NAME", Value: cluster.Name, }, - { + corev1.EnvVar{ // TODO: should we really use this one? // should we mount an emptyDir volume just for that? Name: "SPOOL_DIRECTORY", Value: "/controller/wal-restore-spool", }, - { + corev1.EnvVar{ Name: "CUSTOM_CNPG_GROUP", Value: cluster.GetObjectKind().GroupVersionKind().Group, }, - { + corev1.EnvVar{ Name: "CUSTOM_CNPG_VERSION", Value: cluster.GetObjectKind().GroupVersionKind().Version, }, - } + ) envs = append(envs, config.env...)