From f0477234f2e3d5725f34827b61b9982354e0b3eb Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Fri, 6 Mar 2026 09:44:44 +0100 Subject: [PATCH] [chore]: fix deprecatedComment issues from gocritic Signed-off-by: Matthieu MOREL --- .golangci.yaml | 38 +++++++++++++++++++ apis/v1alpha1/instrumentation_types.go | 7 ++++ apis/v1alpha1/opentelemetrycollector_types.go | 4 ++ docs/api/instrumentations.md | 7 ++++ docs/api/opentelemetrycollectors.md | 4 ++ pkg/collector/upgrade/versions.go | 10 +++-- 6 files changed, 66 insertions(+), 4 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index bfa6fdff29..bbf6075285 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -19,6 +19,40 @@ linters: desc: Use 'errors.Join' instead of go.uber.org/multierr exhaustive: default-signifies-exhaustive: true + gocritic: + disabled-checks: + - appendAssign + - appendCombine + - argOrder + - assignOp + - builtinShadow + - commentedOutCode + - deferInLoop + - elseif + - emptyFallthrough + - emptyStringTest + - exitAfterDefer + - filepathJoin + - httpNoBody + - hugeParam + - ifElseChain + - importShadow + - nestingReduce + - octalLiteral + - offBy1 + - paramTypeCombine + - rangeValCopy + - redundantSprint + - regexpMust + - regexpSimplify + - sloppyReassign + - stringXbytes + - typeDefFirst + - typeSwitchVar + - unlambda + - unnamedResult + - whyNoLint + enable-all: true goheader: template: |- Copyright The OpenTelemetry Authors @@ -144,6 +178,7 @@ linters: - errcheck - errorlint - exhaustive + - gocritic - godot - goheader - gosec @@ -167,6 +202,9 @@ linters: - legacy - std-error-handling rules: + - linters: + - staticcheck + text: ".*.VolumeSizeLimit is deprecated:" - linters: - gosec path: _test\.go diff --git a/apis/v1alpha1/instrumentation_types.go b/apis/v1alpha1/instrumentation_types.go index 35a2f7552d..9cc887fe1e 100644 --- a/apis/v1alpha1/instrumentation_types.go +++ b/apis/v1alpha1/instrumentation_types.go @@ -163,6 +163,7 @@ type Java struct { // VolumeSizeLimit defines size limit for volume used for auto-instrumentation. // The default size is 200Mi. + // // Deprecated: use spec..volume.size instead. This field will be inactive in a future release. VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"` @@ -202,6 +203,7 @@ type NodeJS struct { // VolumeSizeLimit defines size limit for volume used for auto-instrumentation. // The default size is 200Mi. + // // Deprecated: use spec..volume.size instead. This field will be inactive in a future release. VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"` @@ -228,6 +230,7 @@ type Python struct { // VolumeSizeLimit defines size limit for volume used for auto-instrumentation. // The default size is 200Mi. + // // Deprecated: use spec..volume.size instead. This field will be inactive in a future release. VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"` @@ -254,6 +257,7 @@ type DotNet struct { // VolumeSizeLimit defines size limit for volume used for auto-instrumentation. // The default size is 200Mi. + // // Deprecated: use spec..volume.size instead. This field will be inactive in a future release. VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"` @@ -278,6 +282,7 @@ type Go struct { // VolumeSizeLimit defines size limit for volume used for auto-instrumentation. // The default size is 200Mi. + // // Deprecated: use spec..volume.size instead. This field will be inactive in a future release. VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"` @@ -304,6 +309,7 @@ type ApacheHttpd struct { // VolumeSizeLimit defines size limit for volume used for auto-instrumentation. // The default size is 200Mi. + // // Deprecated: use spec..volume.size instead. This field will be inactive in a future release. VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"` @@ -345,6 +351,7 @@ type Nginx struct { // VolumeSizeLimit defines size limit for volume used for auto-instrumentation. // The default size is 200Mi. + // // Deprecated: use spec..volume.size instead. This field will be inactive in a future release. VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"` diff --git a/apis/v1alpha1/opentelemetrycollector_types.go b/apis/v1alpha1/opentelemetrycollector_types.go index 8b5e124350..56d0395b5f 100644 --- a/apis/v1alpha1/opentelemetrycollector_types.go +++ b/apis/v1alpha1/opentelemetrycollector_types.go @@ -106,10 +106,12 @@ type OpenTelemetryCollectorSpec struct { Replicas *int32 `json:"replicas,omitempty"` // MinReplicas sets a lower bound to the autoscaling feature. Set this if you are using autoscaling. It must be at least 1 // +optional + // // Deprecated: use "OpenTelemetryCollector.Spec.Autoscaler.MinReplicas" instead. MinReplicas *int32 `json:"minReplicas,omitempty"` // MaxReplicas sets an upper bound to the autoscaling feature. If MaxReplicas is set autoscaling is enabled. // +optional + // // Deprecated: use "OpenTelemetryCollector.Spec.Autoscaler.MaxReplicas" instead. MaxReplicas *int32 `json:"maxReplicas,omitempty"` // Autoscaler specifies the pod autoscaling configuration to use @@ -448,11 +450,13 @@ type OpenTelemetryCollectorStatus struct { // Messages about actions performed by the operator on this resource. // +optional // +listType=atomic + // // Deprecated: use Kubernetes events instead. Messages []string `json:"messages,omitempty"` // Replicas is currently not being set and might be removed in the next version. // +optional + // // Deprecated: use "OpenTelemetryCollector.Status.Scale.Replicas" instead. Replicas int32 `json:"replicas,omitempty"` } diff --git a/docs/api/instrumentations.md b/docs/api/instrumentations.md index df7cfac25b..bc1e724883 100644 --- a/docs/api/instrumentations.md +++ b/docs/api/instrumentations.md @@ -271,6 +271,7 @@ If omitted, an emptyDir is used with size limit VolumeSizeLimit
VolumeSizeLimit defines size limit for volume used for auto-instrumentation. The default size is 200Mi. + Deprecated: use spec..volume.size instead. This field will be inactive in a future release.
false @@ -1591,6 +1592,7 @@ If omitted, an emptyDir is used with size limit VolumeSizeLimit
VolumeSizeLimit defines size limit for volume used for auto-instrumentation. The default size is 200Mi. + Deprecated: use spec..volume.size instead. This field will be inactive in a future release.
false @@ -2983,6 +2985,7 @@ If omitted, an emptyDir is used with size limit VolumeSizeLimit
VolumeSizeLimit defines size limit for volume used for auto-instrumentation. The default size is 200Mi. + Deprecated: use spec..volume.size instead. This field will be inactive in a future release.
false @@ -3941,6 +3944,7 @@ If omitted, an emptyDir is used with size limit VolumeSizeLimit
VolumeSizeLimit defines size limit for volume used for auto-instrumentation. The default size is 200Mi. + Deprecated: use spec..volume.size instead. This field will be inactive in a future release.
false @@ -4942,6 +4946,7 @@ If omitted, an emptyDir is used with size limit VolumeSizeLimit
VolumeSizeLimit defines size limit for volume used for auto-instrumentation. The default size is 200Mi. + Deprecated: use spec..volume.size instead. This field will be inactive in a future release.
false @@ -6231,6 +6236,7 @@ If omitted, an emptyDir is used with size limit VolumeSizeLimit
VolumeSizeLimit defines size limit for volume used for auto-instrumentation. The default size is 200Mi. + Deprecated: use spec..volume.size instead. This field will be inactive in a future release.
false @@ -7181,6 +7187,7 @@ If omitted, an emptyDir is used with size limit VolumeSizeLimit
VolumeSizeLimit defines size limit for volume used for auto-instrumentation. The default size is 200Mi. + Deprecated: use spec..volume.size instead. This field will be inactive in a future release.
false diff --git a/docs/api/opentelemetrycollectors.md b/docs/api/opentelemetrycollectors.md index 5344906855..5b871ffea6 100644 --- a/docs/api/opentelemetrycollectors.md +++ b/docs/api/opentelemetrycollectors.md @@ -237,6 +237,7 @@ It is only effective when healthcheckextension is configured in the OpenTelemetr integer MaxReplicas sets an upper bound to the autoscaling feature. If MaxReplicas is set autoscaling is enabled. + Deprecated: use "OpenTelemetryCollector.Spec.Autoscaler.MaxReplicas" instead.

Format: int32
@@ -247,6 +248,7 @@ Deprecated: use "OpenTelemetryCollector.Spec.Autoscaler.MaxReplicas" instead.
integer MinReplicas sets a lower bound to the autoscaling feature. Set this if you are using autoscaling. It must be at least 1 + Deprecated: use "OpenTelemetryCollector.Spec.Autoscaler.MinReplicas" instead.

Format: int32
@@ -19955,6 +19957,7 @@ OpenTelemetryCollectorStatus defines the observed state of OpenTelemetryCollecto []string Messages about actions performed by the operator on this resource. + Deprecated: use Kubernetes events instead.
false @@ -19963,6 +19966,7 @@ Deprecated: use Kubernetes events instead.
integer Replicas is currently not being set and might be removed in the next version. + Deprecated: use "OpenTelemetryCollector.Status.Scale.Replicas" instead.

Format: int32
diff --git a/pkg/collector/upgrade/versions.go b/pkg/collector/upgrade/versions.go index 71069fa909..4f104ca025 100644 --- a/pkg/collector/upgrade/versions.go +++ b/pkg/collector/upgrade/versions.go @@ -10,12 +10,14 @@ import ( "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" ) -// Deprecated use upgradeFuncV1beta1. -type upgradeFunc func(u VersionUpgrade, otelcol *v1alpha1.OpenTelemetryCollector) (*v1alpha1.OpenTelemetryCollector, error) -type upgradeFuncV1beta1 func(u VersionUpgrade, otelcol *v1beta1.OpenTelemetryCollector) (*v1beta1.OpenTelemetryCollector, error) +type ( + // Deprecated: use upgradeFuncV1beta1. + upgradeFunc func(u VersionUpgrade, otelcol *v1alpha1.OpenTelemetryCollector) (*v1alpha1.OpenTelemetryCollector, error) + upgradeFuncV1beta1 func(u VersionUpgrade, otelcol *v1beta1.OpenTelemetryCollector) (*v1beta1.OpenTelemetryCollector, error) +) type otelcolVersion struct { - // deprecated use upgradeV1beta1. + // Deprecated: use upgradeV1beta1. upgrade upgradeFunc upgradeV1beta1 upgradeFuncV1beta1 semver.Version