Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tool github.com/golangci/golangci-lint/cmd/golangci-lint to v1.62.2 #3538

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ KUSTOMIZE_VERSION ?= v5.5.0
# renovate: datasource=go depName=sigs.k8s.io/controller-tools/cmd/controller-gen
CONTROLLER_TOOLS_VERSION ?= v0.16.5
# renovate: datasource=go depName=github.com/golangci/golangci-lint/cmd/golangci-lint
GOLANGCI_LINT_VERSION ?= v1.57.2
GOLANGCI_LINT_VERSION ?= v1.62.2
# renovate: datasource=go depName=sigs.k8s.io/kind
KIND_VERSION ?= v0.26.0
# renovate: datasource=go depName=github.com/kyverno/chainsaw
Expand Down
3 changes: 2 additions & 1 deletion apis/v1beta1/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package v1beta1
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"reflect"
"regexp"
Expand Down Expand Up @@ -452,7 +453,7 @@ func (s *Service) MetricsEndpoint(logger logr.Logger) (string, int32, error) {
errMsg := fmt.Sprintf("couldn't determine metrics port from configuration: %s",
telemetry.Metrics.Address)
logger.Info(errMsg)
return "", 0, fmt.Errorf(errMsg)
return "", 0, errors.New(errMsg)
}

// The regex below matches on strings that end with a colon followed by 1 or more numbers (representing the port).
Expand Down
2 changes: 1 addition & 1 deletion cmd/operator-opamp-bridge/metrics/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func NewMetricReporter(logger logr.Logger, dest *protobufs.TelemetryConnectionSe

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

reporter.process, err = process.NewProcess(int32(os.Getpid()))
reporter.process, err = process.NewProcess(int32(os.Getpid())) //nolint: gosec // this is guaranteed to not overflow
if err != nil {
return nil, fmt.Errorf("cannot query own process: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/operator-opamp-bridge/operator/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (c Client) Apply(name string, namespace string, configmap *protobufs.AgentC
}

func (c Client) validateComponents(collectorConfig *v1beta1.Config) error {
if c.componentsAllowed == nil || len(c.componentsAllowed) == 0 {
if len(c.componentsAllowed) == 0 {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/components/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func PortFromEndpoint(endpoint string) (int32, error) {
return UnsetPort, PortNotFoundErr
}

return int32(port), err
return int32(port), err //nolint: gosec // disable G115, this is guaranteed to not overflow due to the bitSize in the ParseInt call
}

type ParserRetriever func(string) Parser
Expand Down
6 changes: 3 additions & 3 deletions internal/components/exporters/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestExporterComponentParsers(t *testing.T) {
for _, tt := range []struct {
exporterName string
parserName string
defaultPort int
defaultPort int32
}{
{"prometheus", "__prometheus", 8888},
} {
Expand Down Expand Up @@ -88,7 +88,7 @@ func TestExporterComponentParsers(t *testing.T) {
assert.NoError(t, err)
assert.Len(t, ports, 1)
assert.EqualValues(t, tt.defaultPort, ports[0].Port)
assert.Equal(t, naming.PortName(tt.exporterName, int32(tt.defaultPort)), ports[0].Name)
assert.Equal(t, naming.PortName(tt.exporterName, tt.defaultPort), ports[0].Name)
})

t.Run("allows port to be overridden", func(t *testing.T) {
Expand All @@ -104,7 +104,7 @@ func TestExporterComponentParsers(t *testing.T) {
assert.NoError(t, err)
assert.Len(t, ports, 1)
assert.EqualValues(t, 65535, ports[0].Port)
assert.Equal(t, naming.PortName(tt.exporterName, int32(tt.defaultPort)), ports[0].Name)
assert.Equal(t, naming.PortName(tt.exporterName, tt.defaultPort), ports[0].Name)
})
})
}
Expand Down
6 changes: 3 additions & 3 deletions internal/components/extensions/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestExtensionsComponentParsers(t *testing.T) {
for _, tt := range []struct {
exporterName string
parserName string
defaultPort int
defaultPort int32
}{
{"health_check", "__health_check", 13133},
} {
Expand Down Expand Up @@ -88,7 +88,7 @@ func TestExtensionsComponentParsers(t *testing.T) {
assert.NoError(t, err)
assert.Len(t, ports, 1)
assert.EqualValues(t, tt.defaultPort, ports[0].Port)
assert.Equal(t, naming.PortName(tt.exporterName, int32(tt.defaultPort)), ports[0].Name)
assert.Equal(t, naming.PortName(tt.exporterName, tt.defaultPort), ports[0].Name)
})

t.Run("allows port to be overridden", func(t *testing.T) {
Expand All @@ -104,7 +104,7 @@ func TestExtensionsComponentParsers(t *testing.T) {
assert.NoError(t, err)
assert.Len(t, ports, 1)
assert.EqualValues(t, 65535, ports[0].Port)
assert.Equal(t, naming.PortName(tt.exporterName, int32(tt.defaultPort)), ports[0].Name)
assert.Equal(t, naming.PortName(tt.exporterName, tt.defaultPort), ports[0].Name)
})
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestDownstreamParsers(t *testing.T) {
desc string
receiverName string
parserName string
defaultPort int
defaultPort int32
listenAddrParser bool
}{
{"zipkin", "zipkin", "__zipkin", 9411, false},
Expand Down Expand Up @@ -118,7 +118,7 @@ func TestDownstreamParsers(t *testing.T) {
assert.NoError(t, err)
assert.Len(t, ports, 1)
assert.EqualValues(t, tt.defaultPort, ports[0].Port)
assert.Equal(t, naming.PortName(tt.receiverName, int32(tt.defaultPort)), ports[0].Name)
assert.Equal(t, naming.PortName(tt.receiverName, tt.defaultPort), ports[0].Name)
})

t.Run("allows port to be overridden", func(t *testing.T) {
Expand All @@ -142,7 +142,7 @@ func TestDownstreamParsers(t *testing.T) {
assert.NoError(t, err)
assert.Len(t, ports, 1)
assert.EqualValues(t, 65535, ports[0].Port)
assert.Equal(t, naming.PortName(tt.receiverName, int32(tt.defaultPort)), ports[0].Name)
assert.Equal(t, naming.PortName(tt.receiverName, tt.defaultPort), ports[0].Name)
})

t.Run("returns a default config", func(t *testing.T) {
Expand Down
Loading