Skip to content

Commit 2ebf28a

Browse files
renovate-botyurishkuro
authored andcommitted
Update module github.com/golangci/golangci-lint to v1.60.0 (jaegertracing#5841)
* Manually fixed new linter errors * Change go version check to not be triggered by newly released Go versions, for more stable PRs * Refactor lint target in the Makefile to split into independent targets [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/golangci/golangci-lint](https://togithub.com/golangci/golangci-lint) | `v1.59.1` -> `v1.60.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgolangci%2fgolangci-lint/v1.60.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fgolangci%2fgolangci-lint/v1.60.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fgolangci%2fgolangci-lint/v1.59.1/v1.60.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgolangci%2fgolangci-lint/v1.59.1/v1.60.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>golangci/golangci-lint (github.com/golangci/golangci-lint)</summary> ### [`v1.60.0`](https://togithub.com/golangci/golangci-lint/compare/v1.59.1...v1.60.0) [Compare Source](https://togithub.com/golangci/golangci-lint/compare/v1.59.1...v1.60.0) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/jaegertracing/jaeger). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiY2hhbmdlbG9nOmRlcGVuZGVuY2llcyJdfQ==--> --------- Signed-off-by: Mend Renovate <[email protected]> Signed-off-by: Yuri Shkuro <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]> Signed-off-by: Jared Tan <[email protected]>
1 parent 106dcad commit 2ebf28a

File tree

21 files changed

+136
-115
lines changed

21 files changed

+136
-115
lines changed

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ linters-settings:
220220
# looks useful, but requires refactoring: "calls to log.Fatal only in main() or init() functions"
221221
- name: deep-exit
222222
disabled: true
223+
# this rule conflicts with nolintlint which does insist on no-space in //nolint
224+
- name: comment-spacings
225+
disabled: true
223226
testifylint:
224227
disable:
225228
- float-compare

Makefile

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,6 @@ nocover:
179179
@echo Verifying that all packages have test files to count in coverage
180180
@scripts/check-test-files.sh $(ALL_PKGS)
181181

182-
.PHONY: goleak
183-
goleak:
184-
@echo Verifying that all packages with tests have goleak in their TestMain
185-
@scripts/check-goleak-files.sh $(ALL_PKGS)
186-
187182
.PHONY: fmt
188183
fmt: $(GOFUMPT)
189184
@echo Running import-order-cleanup on ALL_SRC ...
@@ -196,12 +191,35 @@ fmt: $(GOFUMPT)
196191
@./scripts/updateLicense.py $(ALL_SRC) $(SCRIPTS_SRC)
197192

198193
.PHONY: lint
199-
lint: $(LINT) goleak
194+
lint: lint-license lint-imports lint-semconv lint-goversion lint-goleak lint-go
195+
196+
.PHONY: lint-license
197+
lint-license:
198+
@echo Verifying that all files have license headers
200199
@./scripts/updateLicense.py $(ALL_SRC) $(SCRIPTS_SRC) > $(FMT_LOG)
200+
@[ ! -s "$(FMT_LOG)" ] || (echo "License check failures, run 'make fmt'" | cat - $(FMT_LOG) && false)
201+
202+
.PHONY: lint-imports
203+
lint-imports:
204+
@echo Verifying that all Go files have correctly ordered imports
201205
@./scripts/import-order-cleanup.py -o stdout -t $(ALL_SRC) > $(IMPORT_LOG)
202-
@[ ! -s "$(FMT_LOG)" -a ! -s "$(IMPORT_LOG)" ] || (echo "License check or import ordering failures, run 'make fmt'" | cat - $(FMT_LOG) $(IMPORT_LOG) && false)
206+
@[ ! -s "$(IMPORT_LOG)" ] || (echo "Import ordering failures, run 'make fmt'" | cat - $(IMPORT_LOG) && false)
207+
208+
.PHONY: lint-semconv
209+
lint-semconv:
203210
./scripts/check-semconv-version.sh
211+
212+
.PHONY: lint-goversion
213+
lint-goversion:
204214
./scripts/check-go-version.sh
215+
216+
.PHONY: lint-goleak
217+
lint-goleak:
218+
@echo Verifying that all packages with tests have goleak in their TestMain
219+
@scripts/check-goleak-files.sh $(ALL_PKGS)
220+
221+
.PHONY: lint-go
222+
lint-go: $(LINT)
205223
$(LINT) -v run
206224

207225
.PHONY: build-examples

cmd/collector/app/handler/grpc_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (c *batchConsumer) consume(ctx context.Context, batch *model.Batch) error {
9393
})
9494
if err != nil {
9595
if errors.Is(err, processor.ErrBusy) {
96-
return status.Errorf(codes.ResourceExhausted, err.Error())
96+
return status.Error(codes.ResourceExhausted, err.Error())
9797
}
9898
c.logger.Error("cannot process spans", zap.Error(err))
9999
return err

cmd/collector/app/span_processor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ func TestSpanProcessorCountSpan(t *testing.T) {
474474
time.Second,
475475
time.Millisecond,
476476
)
477-
assert.Greater(t, p.spansProcessed.Load(), uint64(0))
477+
assert.Positive(t, p.spansProcessed.Load())
478478
}
479479

480480
for i := 0; i < 10000; i++ {

cmd/ingester/app/consumer/deadlock_detector_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestNoClosingSignalIfMessagesProcessedInInterval(t *testing.T) {
4545
w := f.startMonitoringForPartition(1)
4646

4747
w.incrementMsgCount()
48-
assert.Zero(t, len(w.closePartitionChannel()))
48+
assert.Empty(t, w.closePartitionChannel())
4949
w.close()
5050
}
5151

@@ -160,6 +160,6 @@ func TestApiCompatibilityWhenDeadlockDetectorDisabled(t *testing.T) {
160160

161161
w.incrementMsgCount()
162162
w.incrementAllPartitionMsgCount()
163-
assert.Zero(t, len(w.closePartitionChannel()))
163+
assert.Empty(t, w.closePartitionChannel())
164164
w.close()
165165
}

cmd/query/app/apiv3/grpc_handler.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package apiv3
1616

1717
import (
1818
"context"
19+
"errors"
1920
"fmt"
2021

2122
"github.com/gogo/protobuf/types"
@@ -59,11 +60,11 @@ func (h *Handler) GetTrace(request *api_v3.GetTraceRequest, stream api_v3.QueryS
5960
func (h *Handler) FindTraces(request *api_v3.FindTracesRequest, stream api_v3.QueryService_FindTracesServer) error {
6061
query := request.GetQuery()
6162
if query == nil {
62-
return status.Errorf(codes.InvalidArgument, "missing query")
63+
return status.Error(codes.InvalidArgument, "missing query")
6364
}
6465
if query.GetStartTimeMin() == nil ||
6566
query.GetStartTimeMax() == nil {
66-
return fmt.Errorf("start time min and max are required parameters")
67+
return errors.New("start time min and max are required parameters")
6768
}
6869

6970
queryParams := &spanstore.TraceQueryParameters{

cmd/query/app/apiv3/http_gateway_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package apiv3
55

66
import (
7+
"errors"
78
"fmt"
89
"io"
910
"net/http"
@@ -105,7 +106,7 @@ func TestHTTPGatewayTryHandleError(t *testing.T) {
105106
gw.Logger = logger
106107
w = httptest.NewRecorder()
107108
const e = "some err"
108-
assert.True(t, gw.tryHandleError(w, fmt.Errorf(e), http.StatusInternalServerError))
109+
assert.True(t, gw.tryHandleError(w, errors.New(e), http.StatusInternalServerError))
109110
assert.Contains(t, log.String(), e, "logs error if status code is 500")
110111
assert.Contains(t, string(w.Body.String()), e, "writes error message to body")
111112
}
@@ -118,7 +119,7 @@ func TestHTTPGatewayOTLPError(t *testing.T) {
118119
const simErr = "simulated error"
119120
gw.returnSpansTestable(nil, w,
120121
func(_ []*model.Span) (ptrace.Traces, error) {
121-
return ptrace.Traces{}, fmt.Errorf(simErr)
122+
return ptrace.Traces{}, errors.New(simErr)
122123
},
123124
)
124125
assert.Contains(t, w.Body.String(), simErr)
@@ -138,7 +139,7 @@ func TestHTTPGatewayGetTraceErrors(t *testing.T) {
138139
const simErr = "simulated error"
139140
gw.reader.
140141
On("GetTrace", matchContext, matchTraceID).
141-
Return(nil, fmt.Errorf(simErr)).Once()
142+
Return(nil, errors.New(simErr)).Once()
142143

143144
r, err = http.NewRequest(http.MethodGet, "/api/v3/traces/123", nil)
144145
require.NoError(t, err)
@@ -247,7 +248,7 @@ func TestHTTPGatewayFindTracesErrors(t *testing.T) {
247248
gw := setupHTTPGatewayNoServer(t, "", tenancy.Options{})
248249
gw.reader.
249250
On("FindTraces", matchContext, qp).
250-
Return(nil, fmt.Errorf(simErr)).Once()
251+
Return(nil, errors.New(simErr)).Once()
251252

252253
gw.router.ServeHTTP(w, r)
253254
assert.Contains(t, w.Body.String(), simErr)
@@ -260,7 +261,7 @@ func TestHTTPGatewayGetServicesErrors(t *testing.T) {
260261
const simErr = "simulated error"
261262
gw.reader.
262263
On("GetServices", matchContext).
263-
Return(nil, fmt.Errorf(simErr)).Once()
264+
Return(nil, errors.New(simErr)).Once()
264265

265266
r, err := http.NewRequest(http.MethodGet, "/api/v3/services", nil)
266267
require.NoError(t, err)
@@ -276,7 +277,7 @@ func TestHTTPGatewayGetOperationsErrors(t *testing.T) {
276277
const simErr = "simulated error"
277278
gw.reader.
278279
On("GetOperations", matchContext, qp).
279-
Return(nil, fmt.Errorf(simErr)).Once()
280+
Return(nil, errors.New(simErr)).Once()
280281

281282
r, err := http.NewRequest(http.MethodGet, "/api/v3/operations?service=foo&span_kind=server", nil)
282283
require.NoError(t, err)

cmd/query/app/http_handler_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,9 @@ func TestSearchByTraceIDNotFound(t *testing.T) {
428428

429429
func TestSearchByTraceIDFailure(t *testing.T) {
430430
ts := initializeTestServer(t)
431-
whatsamattayou := "https://youtu.be/WrKFOCg13QQ"
431+
whatsamattayou := "whatsamattayou"
432432
ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")).
433-
Return(nil, fmt.Errorf(whatsamattayou)).Once()
433+
Return(nil, errors.New(whatsamattayou)).Once()
434434

435435
var response structuredResponse
436436
err := getJSON(ts.server.URL+`/api/traces?traceID=1`, &response)
@@ -763,7 +763,7 @@ func TestMetricsReaderError(t *testing.T) {
763763
tc.mockedQueryMethod,
764764
mock.AnythingOfType("*context.valueCtx"),
765765
mock.AnythingOfType(tc.mockedQueryMethodParamType),
766-
).Return(tc.mockedResponse, fmt.Errorf(tc.wantErrorMessage)).Once()
766+
).Return(tc.mockedResponse, errors.New(tc.wantErrorMessage)).Once()
767767

768768
// Test
769769
var response metrics.MetricFamily

cmd/query/app/query_parser_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package app
1717

1818
import (
19-
"fmt"
2019
"net/http"
2120
"regexp"
2221
"testing"
@@ -174,7 +173,7 @@ func TestParseTraceQuery(t *testing.T) {
174173
} else {
175174
matched, matcherr := regexp.MatchString(test.errMsg, err.Error())
176175
require.NoError(t, matcherr)
177-
assert.True(t, matched, fmt.Sprintf("Error \"%s\" should match \"%s\"", err.Error(), test.errMsg))
176+
assert.True(t, matched, "Error \"%s\" should match \"%s\"", err.Error(), test.errMsg)
178177
}
179178
})
180179
}

crossdock/services/tracehandler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ func TestCreateTracesLoop(t *testing.T) {
276276
}
277277
time.Sleep(time.Millisecond)
278278
}
279-
assert.Greater(t, h.CallCount(), int64(0))
279+
assert.Positive(t, h.CallCount())
280280
}
281281

282282
func TestValidateAdaptiveSamplingTraces(t *testing.T) {

0 commit comments

Comments
 (0)