diff --git a/.github/workflows/go-tests-windows.yml b/.github/workflows/go-tests-windows.yml index 5a463bab99c..6e623b26e09 100644 --- a/.github/workflows/go-tests-windows.yml +++ b/.github/workflows/go-tests-windows.yml @@ -57,6 +57,6 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.59 + version: v1.60 args: --issues-exit-code=1 --timeout 10m only-new-issues: false diff --git a/.github/workflows/go-tests.yml b/.github/workflows/go-tests.yml index 58b8dc61a0d..dfdbd8ab0e9 100644 --- a/.github/workflows/go-tests.yml +++ b/.github/workflows/go-tests.yml @@ -158,6 +158,6 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.59 + version: v1.60 args: --issues-exit-code=1 --timeout 10m only-new-issues: false diff --git a/.golangci.yml b/.golangci.yml index fb1dab623c1..f12d7086b62 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -17,6 +17,7 @@ linters-settings: disable: - reflectvaluecompare - fieldalignment + - printf maintidx: # raise this after refactoring diff --git a/cmd/notification-email/main.go b/cmd/notification-email/main.go index 3b535ae7ffa..2707b7fe1af 100644 --- a/cmd/notification-email/main.go +++ b/cmd/notification-email/main.go @@ -81,7 +81,7 @@ func (n *EmailPlugin) Configure(ctx context.Context, config *protobufs.Config) ( return nil, errors.New("SMTP host is not set") } - if d.ReceiverEmails == nil || len(d.ReceiverEmails) == 0 { + if len(d.ReceiverEmails) == 0 { return nil, errors.New("receiver emails are not set") } diff --git a/pkg/acquisition/modules/appsec/appsec_runner.go b/pkg/acquisition/modules/appsec/appsec_runner.go index ed49d6a7b41..de34b62d704 100644 --- a/pkg/acquisition/modules/appsec/appsec_runner.go +++ b/pkg/acquisition/modules/appsec/appsec_runner.go @@ -167,7 +167,7 @@ func (r *AppsecRunner) processRequest(tx appsec.ExtendedTransaction, request *ap return nil } - if request.Body != nil && len(request.Body) > 0 { + if len(request.Body) > 0 { in, _, err = request.Tx.WriteRequestBody(request.Body) if err != nil { r.logger.Errorf("unable to write request body : %s", err) diff --git a/pkg/apiserver/middlewares/v1/ocsp.go b/pkg/apiserver/middlewares/v1/ocsp.go index 24557bfda7b..0b6406ad0e7 100644 --- a/pkg/apiserver/middlewares/v1/ocsp.go +++ b/pkg/apiserver/middlewares/v1/ocsp.go @@ -70,7 +70,7 @@ func (oc *OCSPChecker) query(server string, cert *x509.Certificate, issuer *x509 // It returns a boolean indicating if the certificate is revoked and a boolean indicating // if the OCSP check was successful and could be cached. func (oc *OCSPChecker) isRevokedBy(cert *x509.Certificate, issuer *x509.Certificate) (bool, bool) { - if cert.OCSPServer == nil || len(cert.OCSPServer) == 0 { + if len(cert.OCSPServer) == 0 { oc.logger.Infof("TLSAuth: no OCSP Server present in client certificate, skipping OCSP verification") return false, true } diff --git a/pkg/cwhub/hub.go b/pkg/cwhub/hub.go index 1293d6fa235..20a628a493f 100644 --- a/pkg/cwhub/hub.go +++ b/pkg/cwhub/hub.go @@ -153,7 +153,7 @@ func (h *Hub) ItemStats() []string { // Update downloads the latest version of the index and writes it to disk if it changed. It cannot be called after Load() // unless the hub is completely empty. func (h *Hub) Update(ctx context.Context) error { - if h.pathIndex != nil && len(h.pathIndex) > 0 { + if len(h.pathIndex) > 0 { // if this happens, it's a bug. return errors.New("cannot update hub after items have been loaded") } diff --git a/pkg/database/machines.go b/pkg/database/machines.go index 75b0ee5fdaa..3c8cbabbfa7 100644 --- a/pkg/database/machines.go +++ b/pkg/database/machines.go @@ -35,7 +35,7 @@ func (c *Client) MachineUpdateBaseMetrics(machineID string, baseMetrics models.B var heartbeat time.Time - if baseMetrics.Metrics == nil || len(baseMetrics.Metrics) == 0 { + if len(baseMetrics.Metrics) == 0 { heartbeat = time.Now().UTC() } else { heartbeat = time.Unix(*baseMetrics.Metrics[0].Meta.UtcNowTimestamp, 0)