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

chore(deps): Bump golangci-lint from v1.61.0 to v1.62.0 #16172

Merged
merged 4 commits into from
Nov 12, 2024
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
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
- run: 'make check-deps'
- run:
name: "Install golangci-lint"
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.0
- run:
name: "golangci-lint/Linux"
# There are only 4 vCPUs available for this executor, so use only 4 instead of the default number
Expand All @@ -120,7 +120,7 @@ jobs:
- check-changed-files-or-halt
- run:
name: "Install golangci-lint"
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.0
- run:
name: "golangci-lint/macOS"
# There are only 4 vCPUs available for this executor, so use only 4 instead of the default number
Expand All @@ -134,7 +134,7 @@ jobs:
- check-changed-files-or-halt
- run:
name: "Install golangci-lint"
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.0
- run:
name: "golangci-lint/Windows"
# There are only 4 vCPUs available for this executor, so use only 4 instead of the default number
Expand Down
31 changes: 13 additions & 18 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ linters-settings:
- codegenComment
- commentedOutCode
- deferInLoop
- dupArg
- deprecatedComment
- dupArg
- dupBranchBody
- dupCase
- dupSubExpr
Expand Down Expand Up @@ -130,8 +130,8 @@ linters-settings:
# performance
- appendCombine
- equalFold
- indexAlloc
- hugeParam
- indexAlloc
- preferDecodeRune
- preferFprint
- preferStringWriter
Expand Down Expand Up @@ -280,9 +280,10 @@ linters-settings:
- name: import-shadowing
- name: increment-decrement
- name: indent-error-flow
- name: max-public-structs
exclude: [ "TEST" ]
arguments: [ 5 ]
# Enable again when https://github.com/mgechev/revive/issues/1103 is fixed
# - name: max-public-structs
# exclude: [ "TEST" ]
# arguments: [ 5 ]
- name: modifies-parameter
- name: modifies-value-receiver
- name: optimize-operands-order
Expand All @@ -295,16 +296,10 @@ linters-settings:
- name: redundant-import-alias
- name: string-format
arguments:
- - 'fmt.Errorf[0]'
- - 'fmt.Errorf[0],errors.New[0]'
- '/^([^A-Z]|$)/'
- 'Error string must not start with a capital letter.'
- - 'fmt.Errorf[0]'
- '/(^|[^\.!?])$/'
- 'Error string must not end in punctuation.'
- - 'errors.New[0]'
- '/^([^A-Z]|$)/'
- 'Error string must not start with a capital letter.'
- - 'errors.New[0]'
- - 'fmt.Errorf[0],errors.New[0]'
- '/(^|[^\.!?])$/'
- 'Error string must not end in punctuation.'
- - 'panic'
Expand Down Expand Up @@ -354,11 +349,6 @@ linters-settings:
- suite-thelper
- useless-assert

run:
# Timeout for analysis, e.g. 30s, 5m.
# Default: 1m
timeout: 10m

issues:
# List of regexps of issue texts to exclude.
#
Expand Down Expand Up @@ -478,3 +468,8 @@ output:
# Show statistics per linter.
# Default: false
show-stats: true

run:
# Timeout for analysis, e.g. 30s, 5m.
# Default: 1m
timeout: 10m
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ vet:
.PHONY: lint-install
lint-install:
@echo "Installing golangci-lint"
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.0

@echo "Installing markdownlint"
npm install -g markdownlint-cli
Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestReadBinaryFile(t *testing.T) {
cmd.Stderr = &errb
err = cmd.Run()

require.NoError(t, err, fmt.Sprintf("stdout: %s, stderr: %s", outb.String(), errb.String()))
require.NoErrorf(t, err, "stdout: %s, stderr: %s", outb.String(), errb.String())
c := config.NewConfig()
err = c.LoadConfig(binaryFile)
require.Error(t, err)
Expand Down
8 changes: 4 additions & 4 deletions plugins/common/parallel/parallel_test.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package parallel_test

import (
"fmt"
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/metric"
"github.com/influxdata/telegraf/plugins/common/parallel"
"github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/require"
)

func TestOrderedJobsStayOrdered(t *testing.T) {
Expand All @@ -31,7 +31,7 @@ func TestOrderedJobsStayOrdered(t *testing.T) {
p.Stop()

i := 0
require.Len(t, acc.Metrics, 20000, fmt.Sprintf("expected 20k metrics but got %d", len(acc.GetTelegrafMetrics())))
require.Len(t, acc.Metrics, 20000)
for _, m := range acc.GetTelegrafMetrics() {
v, ok := m.GetField("val")
require.True(t, ok)
Expand Down Expand Up @@ -63,7 +63,7 @@ func TestUnorderedJobsDontDropAnyJobs(t *testing.T) {
p.Stop()

actualTotal := int64(0)
require.Len(t, acc.Metrics, 20000, fmt.Sprintf("expected 20k metrics but got %d", len(acc.GetTelegrafMetrics())))
require.Len(t, acc.Metrics, 20000)
for _, m := range acc.GetTelegrafMetrics() {
v, ok := m.GetField("val")
require.True(t, ok)
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/aliyuncms/aliyuncms_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ func TestGather(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
var acc testutil.Accumulator
plugin.Metrics[0].MetricNames = tt.metricNames
require.Empty(t, acc.GatherError(plugin.Gather))
require.NoError(t, acc.GatherError(plugin.Gather))
require.Equal(t, acc.HasMeasurement("aliyuncms_acs_slb_dashboard"), tt.hasMeasurement)
if tt.hasMeasurement {
acc.AssertContainsTaggedFields(t, "aliyuncms_acs_slb_dashboard", tt.expected[0].Fields(), tt.expected[0].Tags())
Expand Down
9 changes: 4 additions & 5 deletions plugins/inputs/dcos/dcos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dcos

import (
"context"
"fmt"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -200,7 +199,7 @@ func TestAddNodeMetrics(t *testing.T) {
dcos := &DCOS{}
dcos.addNodeMetrics(&acc, "a", tt.metrics)
for i, ok := range tt.check(&acc) {
require.True(t, ok, fmt.Sprintf("Index was not true: %d", i))
require.Truef(t, ok, "Index was not true: %d", i)
}
})
}
Expand Down Expand Up @@ -271,7 +270,7 @@ func TestAddContainerMetrics(t *testing.T) {
dcos := &DCOS{}
dcos.addContainerMetrics(&acc, "a", tt.metrics)
for i, ok := range tt.check(&acc) {
require.True(t, ok, fmt.Sprintf("Index was not true: %d", i))
require.Truef(t, ok, "Index was not true: %d", i)
}
})
}
Expand Down Expand Up @@ -345,7 +344,7 @@ func TestAddAppMetrics(t *testing.T) {
dcos := &DCOS{}
dcos.addAppMetrics(&acc, "a", tt.metrics)
for i, ok := range tt.check(&acc) {
require.True(t, ok, fmt.Sprintf("Index was not true: %d", i))
require.Truef(t, ok, "Index was not true: %d", i)
}
})
}
Expand Down Expand Up @@ -434,7 +433,7 @@ func TestGatherFilterNode(t *testing.T) {
err := dcos.Gather(&acc)
require.NoError(t, err)
for i, ok := range tt.check(&acc) {
require.True(t, ok, fmt.Sprintf("Index was not true: %d", i))
require.Truef(t, ok, "Index was not true: %d", i)
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/inputs/intel_rdt/intel_rdt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ func TestSplitCSVLineIntoValues(t *testing.T) {
splitCSV, err = splitCSVLineIntoValues(wrongLine)
require.Error(t, err)
require.Equal(t, "", splitCSV.timeValue)
require.Nil(t, nil, splitCSV.metricsValues)
require.Nil(t, nil, splitCSV.coreOrPIDsValues)
require.Nil(t, splitCSV.metricsValues)
require.Nil(t, splitCSV.coreOrPIDsValues)
}

func TestFindPIDsInMeasurement(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions plugins/inputs/internal/internal_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package internal

import (
"fmt"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -108,7 +107,7 @@ func TestGostats(t *testing.T) {
switch value.(type) {
case int64, uint64, float64:
default:
require.True(t, false, fmt.Sprintf("field %s is of non-numeric type %T\n", name, value))
require.Truef(t, false, "field %s is of non-numeric type %T\n", name, value)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,22 +218,22 @@ func TestPostgresqlFieldOutputIntegration(t *testing.T) {

for _, field := range intMetrics {
_, found := acc.Int64Field(measurement, field)
require.True(t, found, fmt.Sprintf("expected %s to be an integer", field))
require.Truef(t, found, "expected %s to be an integer", field)
}

for _, field := range int32Metrics {
_, found := acc.Int32Field(measurement, field)
require.True(t, found, fmt.Sprintf("expected %s to be an int32", field))
require.Truef(t, found, "expected %s to be an int32", field)
}

for _, field := range floatMetrics {
_, found := acc.FloatField(measurement, field)
require.True(t, found, fmt.Sprintf("expected %s to be a float64", field))
require.Truef(t, found, "expected %s to be a float64", field)
}

for _, field := range stringMetrics {
_, found := acc.StringField(measurement, field)
require.True(t, found, fmt.Sprintf("expected %s to be a str", field))
require.Truef(t, found, "expected %s to be a str", field)
}
}

Expand Down
5 changes: 2 additions & 3 deletions plugins/inputs/vsphere/vsphere_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package vsphere
import (
"context"
"crypto/tls"
"fmt"
"net/url"
"os"
"strings"
Expand Down Expand Up @@ -518,7 +517,7 @@ func testCollection(t *testing.T, excludeClusters bool) {
require.NoError(t, v.Start(&acc))
defer v.Stop()
require.NoError(t, v.Gather(&acc))
require.Empty(t, acc.Errors, fmt.Sprintf("Errors found: %s", acc.Errors))
require.Emptyf(t, acc.Errors, "Errors found: %s", acc.Errors)
require.NotEmpty(t, acc.Metrics, "No metrics were collected")
cache := make(map[string]string)
client, err := v.endpoints[0].clientFactory.GetClient(context.Background())
Expand Down Expand Up @@ -621,6 +620,6 @@ func TestVersionLowerThan(t *testing.T) {
}
for _, tc := range tests {
result := versionLowerThan(tc.current, tc.major, tc.minor)
require.Equal(t, tc.result, result, fmt.Sprintf("%s < %d.%d", tc.current, tc.major, tc.minor))
require.Equalf(t, tc.result, result, "%s < %d.%d", tc.current, tc.major, tc.minor)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package win_perf_counters

import (
"errors"
"fmt"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -171,14 +170,10 @@ func TestWinPerfCountersConfigGet2Integration(t *testing.T) {
hostCounters, ok := m.hostCounters["localhost"]
require.True(t, ok)

if len(hostCounters.counters) == 1 {
require.NoError(t, nil)
} else if len(hostCounters.counters) == 0 {
err2 := fmt.Errorf("no results returned from the counterPath: %v", len(hostCounters.counters))
require.NoError(t, err2)
if len(hostCounters.counters) == 0 {
require.FailNow(t, "no results returned from the counterPath: %v", len(hostCounters.counters))
} else if len(hostCounters.counters) > 1 {
err2 := fmt.Errorf("too many results returned from the counterPath: %v", len(hostCounters.counters))
require.NoError(t, err2)
require.FailNow(t, "too many results returned from the counterPath: %v", len(hostCounters.counters))
}
}

Expand Down Expand Up @@ -214,14 +209,10 @@ func TestWinPerfCountersConfigGet3Integration(t *testing.T) {
hostCounters, ok := m.hostCounters["localhost"]
require.True(t, ok)

if len(hostCounters.counters) == 2 {
require.NoError(t, nil)
} else if len(hostCounters.counters) < 2 {
err2 := fmt.Errorf("too few results returned from the counterPath: %v", len(hostCounters.counters))
require.NoError(t, err2)
if len(hostCounters.counters) < 2 {
require.FailNow(t, "too few results returned from the counterPath: %v", len(hostCounters.counters))
} else if len(hostCounters.counters) > 2 {
err2 := fmt.Errorf("too many results returned from the counterPath: %v", len(hostCounters.counters))
require.NoError(t, err2)
require.FailNow(t, "too many results returned from the counterPath: %v", len(hostCounters.counters))
}
}

Expand Down Expand Up @@ -255,14 +246,10 @@ func TestWinPerfCountersConfigGet4Integration(t *testing.T) {
hostCounters, ok := m.hostCounters["localhost"]
require.True(t, ok)

if len(hostCounters.counters) == 2 {
require.NoError(t, nil)
} else if len(hostCounters.counters) < 2 {
err2 := fmt.Errorf("too few results returned from the counterPath: %v", len(hostCounters.counters))
require.NoError(t, err2)
if len(hostCounters.counters) < 2 {
require.FailNow(t, "too few results returned from the counterPath: %v", len(hostCounters.counters))
} else if len(hostCounters.counters) > 2 {
err2 := fmt.Errorf("too many results returned from the counterPath: %v", len(hostCounters.counters))
require.NoError(t, err2)
require.FailNow(t, "too many results returned from the counterPath: %v", len(hostCounters.counters))
}
}

Expand Down Expand Up @@ -296,14 +283,10 @@ func TestWinPerfCountersConfigGet5Integration(t *testing.T) {
hostCounters, ok := m.hostCounters["localhost"]
require.True(t, ok)

if len(hostCounters.counters) == 4 {
require.NoError(t, nil)
} else if len(hostCounters.counters) < 4 {
err2 := fmt.Errorf("too few results returned from the counterPath: %v", len(hostCounters.counters))
require.NoError(t, err2)
if len(hostCounters.counters) < 4 {
require.FailNow(t, "too few results returned from the counterPath: %v", len(hostCounters.counters))
} else if len(hostCounters.counters) > 4 {
err2 := fmt.Errorf("too many results returned from the counterPath: %v", len(hostCounters.counters))
require.NoError(t, err2)
require.FailNow(t, "too many results returned from the counterPath: %v", len(hostCounters.counters))
}
}

Expand Down Expand Up @@ -365,14 +348,10 @@ func TestWinPerfCountersConfigGet7Integration(t *testing.T) {
hostCounters, ok := m.hostCounters["localhost"]
require.True(t, ok)

if len(hostCounters.counters) == 2 {
require.NoError(t, nil)
} else if len(hostCounters.counters) < 2 {
err2 := fmt.Errorf("too few results returned from the counterPath: %v", len(hostCounters.counters))
require.NoError(t, err2)
if len(hostCounters.counters) < 2 {
require.FailNow(t, "too few results returned from the counterPath: %v", len(hostCounters.counters))
} else if len(hostCounters.counters) > 2 {
err2 := fmt.Errorf("too many results returned from the counterPath: %v", len(hostCounters.counters))
require.NoError(t, err2)
require.FailNow(t, "too many results returned from the counterPath: %v", len(hostCounters.counters))
}
}

Expand Down
Loading
Loading