Skip to content

Commit

Permalink
CI: use golangci-lint 1.60 (crowdsecurity#3180)
Browse files Browse the repository at this point in the history
* use golangci-lint 1.60

* lint (gosimple/S1009) -> len(nil) == 0

* nerf govet for now
  • Loading branch information
mmetc authored Aug 19, 2024
1 parent 534fb14 commit 6b9b19b
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/go-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ linters-settings:
disable:
- reflectvaluecompare
- fieldalignment
- printf

maintidx:
# raise this after refactoring
Expand Down
2 changes: 1 addition & 1 deletion cmd/notification-email/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/acquisition/modules/appsec/appsec_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/apiserver/middlewares/v1/ocsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cwhub/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/database/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6b9b19b

Please sign in to comment.