Skip to content

Commit e8bf574

Browse files
authored
[chore]: enable comment-spacings rule from revive (#4792)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
1 parent 9be825f commit e8bf574

File tree

11 files changed

+16
-15
lines changed

11 files changed

+16
-15
lines changed

.golangci.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ linters:
7171
- name: confusing-results
7272
disabled: true # FIXME
7373
- name: comment-spacings
74-
disabled: true # FIXME
74+
arguments:
75+
- +kubebuilder
7576
- name: deep-exit
7677
disabled: true # FIXME
7778
- name: defer

cmd/operator-opamp-bridge/internal/metrics/reporter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func NewMetricReporter(logger logr.Logger, dest *protobufs.TelemetryConnectionSe
9696

9797
reporter.meter = provider.Meter("opamp")
9898

99-
reporter.process, err = process.NewProcess(int32(os.Getpid())) //nolint: gosec // this is guaranteed to not overflow
99+
reporter.process, err = process.NewProcess(int32(os.Getpid())) //nolint:gosec // this is guaranteed to not overflow
100100
if err != nil {
101101
return nil, fmt.Errorf("cannot query own process: %w", err)
102102
}

cmd/otel-allocator/internal/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ func (s *Server) ScrapeConfigsHTMLHandler(c *gin.Context) {
602602
WriteHTMLPageHeader(c.Writer, HeaderData{
603603
Title: "OpenTelemetry Target Allocator - Scrape Configs",
604604
})
605-
//s.scrapeConfigResponse
605+
// s.scrapeConfigResponse
606606
// Marshal the scrape config to JSON
607607
scrapeConfigs := make(map[string]any)
608608
err := json.Unmarshal(s.scrapeConfigResponse, &scrapeConfigs)

cmd/otel-allocator/internal/watcher/promOperator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func NewPrometheusCRWatcher(
6666
// we want to use endpointslices by default
6767
serviceDiscoveryRole := monitoringv1.ServiceDiscoveryRole("EndpointSlice")
6868

69-
//no need to hardcode durations, use default if not set
69+
// no need to hardcode durations, use default if not set
7070
prom := &monitoringv1.Prometheus{
7171
ObjectMeta: metav1.ObjectMeta{
7272
Namespace: cfg.CollectorNamespace,

internal/manifests/collector/container_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ func TestContainerImagePullPolicy(t *testing.T) {
666666
}
667667

668668
func TestContainerEnvFrom(t *testing.T) {
669-
//prepare
669+
// prepare
670670
envFrom1 := corev1.EnvFromSource{
671671
SecretRef: &corev1.SecretEnvSource{
672672
LocalObjectReference: corev1.LocalObjectReference{

internal/manifests/manifestutils/annotations_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestDefaultAnnotations(t *testing.T) {
3333
podAnnotations, err := PodAnnotations(otelcol, []string{})
3434
require.NoError(t, err)
3535

36-
//verify propagation from metadata.annotations to spec.template.spec.metadata.annotations
36+
// verify propagation from metadata.annotations to spec.template.spec.metadata.annotations
3737
assert.Equal(t, "true", podAnnotations["prometheus.io/scrape"])
3838
assert.Equal(t, "8888", podAnnotations["prometheus.io/port"])
3939
assert.Equal(t, "/metrics", podAnnotations["prometheus.io/path"])
@@ -62,11 +62,11 @@ func TestNonDefaultPodAnnotation(t *testing.T) {
6262
podAnnotations, err := PodAnnotations(otelcol, []string{})
6363
require.NoError(t, err)
6464

65-
//verify
65+
// verify
6666
assert.NotContains(t, annotations, "prometheus.io/scrape", "Prometheus scrape annotation should not exist")
6767
assert.NotContains(t, annotations, "prometheus.io/port", "Prometheus port annotation should not exist")
6868
assert.NotContains(t, annotations, "prometheus.io/path", "Prometheus path annotation should not exist")
69-
//verify propagation from metadata.annotations to spec.template.spec.metadata.annotations
69+
// verify propagation from metadata.annotations to spec.template.spec.metadata.annotations
7070
assert.NotContains(t, podAnnotations, "prometheus.io/scrape", "Prometheus scrape annotation should not exist in pod annotations")
7171
assert.NotContains(t, podAnnotations, "prometheus.io/port", "Prometheus port annotation should not exist in pod annotations")
7272
assert.NotContains(t, podAnnotations, "prometheus.io/path", "Prometheus path annotation should not exist in pod annotations")
@@ -99,7 +99,7 @@ func TestUserAnnotations(t *testing.T) {
9999
podAnnotations, err := PodAnnotations(otelcol, []string{})
100100
require.NoError(t, err)
101101

102-
//verify
102+
// verify
103103
assert.Equal(t, "false", annotations["prometheus.io/scrape"])
104104
assert.Equal(t, "1234", annotations["prometheus.io/port"])
105105
assert.Equal(t, "/test", annotations["prometheus.io/path"])

internal/manifests/targetallocator/container_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ func TestContainerLifecycle(t *testing.T) {
606606
}
607607

608608
func TestContainerEnvFrom(t *testing.T) {
609-
//prepare
609+
// prepare
610610
envFrom1 := corev1.EnvFromSource{
611611
SecretRef: &corev1.SecretEnvSource{
612612
LocalObjectReference: corev1.LocalObjectReference{

pkg/collector/upgrade/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func (u VersionUpgrade) ManagedInstance(_ context.Context, otelcol v1beta1.OpenT
141141
}
142142
u.Log.V(1).Info("step upgrade", "name", updated.Name, "namespace", updated.Namespace, "version", available.String())
143143
} else {
144-
upgraded, err := available.upgradeV1beta1(u, &updated) //available.upgrade(params., &updated)
144+
upgraded, err := available.upgradeV1beta1(u, &updated) // available.upgrade(params., &updated)
145145
if err != nil {
146146
u.Log.Error(err, "failed to upgrade managed otelcol instance", "name", updated.Name, "namespace", updated.Namespace)
147147
return updated, err

pkg/collector/upgrade/v0_43_0.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ func upgrade0_43_0(u VersionUpgrade, otelcol *v1alpha1.OpenTelemetryCollector) (
2020
return otelcol, nil
2121
}
2222

23-
//Removing deprecated Spec.Args (--metrics-addr and --metrics-level) based on
23+
// Removing deprecated Spec.Args (--metrics-addr and --metrics-level) based on
2424
// https://github.com/open-telemetry/opentelemetry-collector/pull/4695
25-
//Both args can be used now on the Spec.Config
25+
// Both args can be used now on the Spec.Config
2626
foundMetricsArgs := make(map[string]string)
2727
for argKey, argValue := range otelcol.Spec.Args {
2828
if argKey == "--metrics-addr" || argKey == "--metrics-level" {

pkg/collector/upgrade/v0_57_2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func upgrade0_57_2(u VersionUpgrade, otelcol *v1alpha1.OpenTelemetryCollector) (
2323
return otelcol, fmt.Errorf("couldn't upgrade to v0.57.2, failed to parse configuration: %w", err)
2424
}
2525

26-
//Remove deprecated port field from config. (https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/10853)
26+
// Remove deprecated port field from config. (https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/10853)
2727
extensionsConfig, ok := otelCfg["extensions"].(map[any]any)
2828
if !ok {
2929
// In case there is no extensions config.

0 commit comments

Comments
 (0)