From 5345a2aa22e2eb1e317abb87d066ab95c97971d4 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Tue, 10 Feb 2026 11:41:02 +0100 Subject: [PATCH] chore: update golangci-lint to v2.8.0 (#26354) Signed-off-by: Matthieu MOREL --- .github/workflows/ci-build.yaml | 4 ++-- cmd/argocd/commands/app_resources.go | 9 +++------ hack/installers/install-lint-tools.sh | 4 ++-- manifests/core-install-with-hydrator.yaml | 1 + manifests/core-install.yaml | 1 + manifests/crds/application-crd.yaml | 1 + manifests/ha/install-with-hydrator.yaml | 1 + manifests/ha/install.yaml | 1 + manifests/install-with-hydrator.yaml | 1 + manifests/install.yaml | 1 + pkg/apis/application/v1alpha1/generated.proto | 2 ++ pkg/apis/application/v1alpha1/types.go | 2 ++ renovate-presets/devtool.json5 | 2 +- server/application/application_test.go | 2 +- server/repository/repository.go | 4 ++++ 15 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 7fab415228..9f54c60b2c 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -110,8 +110,8 @@ jobs: - name: Run golangci-lint uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 with: - # renovate: datasource=go packageName=github.com/golangci/golangci-lint versioning=regex:^v(?\d+)\.(?\d+)\.(?\d+)?$ - version: v2.5.0 + # renovate: datasource=go packageName=github.com/golangci/golangci-lint/v2 versioning=regex:^v(?\d+)\.(?\d+)\.(?\d+)?$ + version: v2.8.0 args: --verbose test-go: diff --git a/cmd/argocd/commands/app_resources.go b/cmd/argocd/commands/app_resources.go index 35f0237e44..70c83ece17 100644 --- a/cmd/argocd/commands/app_resources.go +++ b/cmd/argocd/commands/app_resources.go @@ -89,7 +89,7 @@ func NewApplicationGetResourceCommand(clientOpts *argocdclient.ClientOptions) *c // Get manifests of resources // If resource name is "" find all resources of that kind var resources []unstructured.Unstructured - var fetchedStr string + var resourceNames []string for _, r := range tree.Nodes { if (resourceName != "" && r.Name != resourceName) || (group != "" && r.Group != group) || r.Kind != kind { continue @@ -119,14 +119,11 @@ func NewApplicationGetResourceCommand(clientOpts *argocdclient.ClientOptions) *c obj = filterFieldsFromObject(obj, filteredFields) } - fetchedStr += obj.GetName() + ", " + resourceNames = append(resourceNames, obj.GetName()) resources = append(resources, *obj) } + fetchedStr := strings.Join(resourceNames, ", ") printManifests(&resources, len(filteredFields) > 0, resourceName == "", output) - - if fetchedStr != "" { - fetchedStr = strings.TrimSuffix(fetchedStr, ", ") - } log.Infof("Resources '%s' fetched", fetchedStr) } diff --git a/hack/installers/install-lint-tools.sh b/hack/installers/install-lint-tools.sh index 1585479277..cb58d75acd 100755 --- a/hack/installers/install-lint-tools.sh +++ b/hack/installers/install-lint-tools.sh @@ -1,7 +1,7 @@ #!/bin/bash set -eux -o pipefail -# renovate: datasource=go packageName=github.com/golangci/golangci-lint -GOLANGCI_LINT_VERSION=2.5.0 +# renovate: datasource=go packageName=github.com/golangci/golangci-lint/v2 +GOLANGCI_LINT_VERSION=2.8.0 GO111MODULE=on go install "github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v${GOLANGCI_LINT_VERSION}" diff --git a/manifests/core-install-with-hydrator.yaml b/manifests/core-install-with-hydrator.yaml index e16c4557d0..83d214f408 100644 --- a/manifests/core-install-with-hydrator.yaml +++ b/manifests/core-install-with-hydrator.yaml @@ -3191,6 +3191,7 @@ spec: observedAt: description: |- ObservedAt indicates when the application state was updated without querying latest git state + Deprecated: controller no longer updates ObservedAt field format: date-time type: string diff --git a/manifests/core-install.yaml b/manifests/core-install.yaml index 982c66948d..f29790ee1e 100644 --- a/manifests/core-install.yaml +++ b/manifests/core-install.yaml @@ -3191,6 +3191,7 @@ spec: observedAt: description: |- ObservedAt indicates when the application state was updated without querying latest git state + Deprecated: controller no longer updates ObservedAt field format: date-time type: string diff --git a/manifests/crds/application-crd.yaml b/manifests/crds/application-crd.yaml index 022fb1d48b..b1ebbb3fd3 100644 --- a/manifests/crds/application-crd.yaml +++ b/manifests/crds/application-crd.yaml @@ -3190,6 +3190,7 @@ spec: observedAt: description: |- ObservedAt indicates when the application state was updated without querying latest git state + Deprecated: controller no longer updates ObservedAt field format: date-time type: string diff --git a/manifests/ha/install-with-hydrator.yaml b/manifests/ha/install-with-hydrator.yaml index 2cfb64c6c4..28bd768096 100644 --- a/manifests/ha/install-with-hydrator.yaml +++ b/manifests/ha/install-with-hydrator.yaml @@ -3191,6 +3191,7 @@ spec: observedAt: description: |- ObservedAt indicates when the application state was updated without querying latest git state + Deprecated: controller no longer updates ObservedAt field format: date-time type: string diff --git a/manifests/ha/install.yaml b/manifests/ha/install.yaml index 3ca5e0d051..65116a0885 100644 --- a/manifests/ha/install.yaml +++ b/manifests/ha/install.yaml @@ -3191,6 +3191,7 @@ spec: observedAt: description: |- ObservedAt indicates when the application state was updated without querying latest git state + Deprecated: controller no longer updates ObservedAt field format: date-time type: string diff --git a/manifests/install-with-hydrator.yaml b/manifests/install-with-hydrator.yaml index 5124515c67..79ea7a1dbf 100644 --- a/manifests/install-with-hydrator.yaml +++ b/manifests/install-with-hydrator.yaml @@ -3191,6 +3191,7 @@ spec: observedAt: description: |- ObservedAt indicates when the application state was updated without querying latest git state + Deprecated: controller no longer updates ObservedAt field format: date-time type: string diff --git a/manifests/install.yaml b/manifests/install.yaml index dfd044e28c..4f0e11b020 100644 --- a/manifests/install.yaml +++ b/manifests/install.yaml @@ -3191,6 +3191,7 @@ spec: observedAt: description: |- ObservedAt indicates when the application state was updated without querying latest git state + Deprecated: controller no longer updates ObservedAt field format: date-time type: string diff --git a/pkg/apis/application/v1alpha1/generated.proto b/pkg/apis/application/v1alpha1/generated.proto index 4559d9a1b2..cbff6ad165 100644 --- a/pkg/apis/application/v1alpha1/generated.proto +++ b/pkg/apis/application/v1alpha1/generated.proto @@ -714,6 +714,7 @@ message ApplicationStatus { optional OperationState operationState = 7; // ObservedAt indicates when the application state was updated without querying latest git state + // // Deprecated: controller no longer updates ObservedAt field optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time observedAt = 8; @@ -2059,6 +2060,7 @@ message ResourceDiff { optional string liveState = 6; // Diff contains the JSON patch representing the difference between the live and target resource. + // // Deprecated: Use NormalizedLiveState and PredictedLiveState instead to compute differences. optional string diff = 7; diff --git a/pkg/apis/application/v1alpha1/types.go b/pkg/apis/application/v1alpha1/types.go index 31037c930c..425fe1b7cb 100644 --- a/pkg/apis/application/v1alpha1/types.go +++ b/pkg/apis/application/v1alpha1/types.go @@ -1193,6 +1193,7 @@ type ApplicationStatus struct { // OperationState contains information about any ongoing operations, such as a sync OperationState *OperationState `json:"operationState,omitempty" protobuf:"bytes,7,opt,name=operationState"` // ObservedAt indicates when the application state was updated without querying latest git state + // // Deprecated: controller no longer updates ObservedAt field ObservedAt *metav1.Time `json:"observedAt,omitempty" protobuf:"bytes,8,opt,name=observedAt"` // SourceType specifies the type of this application @@ -2191,6 +2192,7 @@ type ResourceDiff struct { // LiveState contains the JSON-serialized resource manifest of the resource currently running in the cluster. LiveState string `json:"liveState,omitempty" protobuf:"bytes,6,opt,name=liveState"` // Diff contains the JSON patch representing the difference between the live and target resource. + // // Deprecated: Use NormalizedLiveState and PredictedLiveState instead to compute differences. Diff string `json:"diff,omitempty" protobuf:"bytes,7,opt,name=diff"` // Hook indicates whether this resource is a hook resource (e.g., pre-sync or post-sync hooks). diff --git a/renovate-presets/devtool.json5 b/renovate-presets/devtool.json5 index ed2fe194c8..8a933a72d6 100644 --- a/renovate-presets/devtool.json5 +++ b/renovate-presets/devtool.json5 @@ -16,7 +16,7 @@ "go" ], "matchPackageNames": [ - "github.com/golangci/golangci-lint", + "github.com/golangci/golangci-lint/v2", "github.com/vektra/mockery/v3" ], "enabled": true diff --git a/server/application/application_test.go b/server/application/application_test.go index c539db1949..fe78865a5d 100644 --- a/server/application/application_test.go +++ b/server/application/application_test.go @@ -1004,7 +1004,7 @@ func TestNoAppEnumeration(t *testing.T) { assert.EqualError(t, err, "rpc error: code = NotFound desc = applications.argoproj.io \"doest-not-exist\" not found", "when the request specifies a project, we can return the standard k8s error message") }) - //nolint:staticcheck,SA1019 // RunResourceAction is deprecated, but we still need to support it for backward compatibility. + //nolint:staticcheck // SA1019: RunResourceAction is deprecated, but we still need to support it for backward compatibility. t.Run("RunResourceAction", func(t *testing.T) { _, err := appServer.RunResourceAction(adminCtx, &application.ResourceActionRunRequest{Name: ptr.To("test"), ResourceName: ptr.To("test"), Group: ptr.To("apps"), Kind: ptr.To("Deployment"), Namespace: ptr.To("test"), Action: ptr.To("restart")}) require.NoError(t, err) diff --git a/server/repository/repository.go b/server/repository/repository.go index e7bbe17763..4e5c966c36 100644 --- a/server/repository/repository.go +++ b/server/repository/repository.go @@ -127,6 +127,7 @@ func (s *Server) getConnectionState(ctx context.Context, url string, project str } // List returns list of repositories +// // Deprecated: Use ListRepositories instead func (s *Server) List(ctx context.Context, q *repositorypkg.RepoQuery) (*v1alpha1.RepositoryList, error) { return s.ListRepositories(ctx, q) @@ -425,6 +426,7 @@ func (s *Server) GetHelmCharts(ctx context.Context, q *repositorypkg.RepoQuery) } // Create creates a repository or repository credential set +// // Deprecated: Use CreateRepository() instead func (s *Server) Create(ctx context.Context, q *repositorypkg.RepoCreateRequest) (*v1alpha1.Repository, error) { return s.CreateRepository(ctx, q) @@ -535,6 +537,7 @@ func (s *Server) CreateWriteRepository(ctx context.Context, q *repositorypkg.Rep } // Update updates a repository or credential set +// // Deprecated: Use UpdateRepository() instead func (s *Server) Update(ctx context.Context, q *repositorypkg.RepoUpdateRequest) (*v1alpha1.Repository, error) { return s.UpdateRepository(ctx, q) @@ -591,6 +594,7 @@ func (s *Server) UpdateWriteRepository(ctx context.Context, q *repositorypkg.Rep } // Delete removes a repository from the configuration +// // Deprecated: Use DeleteRepository() instead func (s *Server) Delete(ctx context.Context, q *repositorypkg.RepoQuery) (*repositorypkg.RepoResponse, error) { return s.DeleteRepository(ctx, q)