Skip to content

Commit

Permalink
bump linter to 1.59
Browse files Browse the repository at this point in the history
  • Loading branch information
Pr0Ger committed Jun 18, 2024
1 parent df4ceef commit 8077c33
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ steps:
- go mod tidy -v
- git diff --exit-code
- name: lint
image: "golangci/golangci-lint:v1.55-alpine"
image: "golangci/golangci-lint:v1.59-alpine"
commands:
- go install github.com/golang/mock/mockgen@latest
- go generate -x
Expand Down
1 change: 0 additions & 1 deletion .errcheck_excludes.txt

This file was deleted.

17 changes: 5 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ linters:
- gomoddirectives
# style preset
- asciicheck
- canonicalheader
- containedctx
- dogsled
- dupl
Expand All @@ -43,20 +44,14 @@ linters:
- unconvert
- whitespace
- wastedassign
disable:
# bugs
- scopelint # deprecated and superseded by exportloopref
# performance
- maligned # deprecated and superseded by govet(fieldalignment)
# unused
- deadcode # deprecated and superseded by unused
- structcheck # deprecated and superseded by unused
- varcheck # deprecated and superseded by unused
linters-settings:
dogsled:
max-blank-identifiers: 3
errcheck:
exclude: .errcheck_excludes.txt
exclude-functions:
- (net/http.ResponseWriter).Write
- github.com/go-chi/render.Render
- github.com/go-chi/render.RenderList
errorlint:
errorf: true
funlen:
Expand All @@ -76,8 +71,6 @@ linters-settings:
retract-allow-no-explanation: false
lll:
tab-width: 4
nolintlint:
allow-leading-space: false
issues:
max-issues-per-linter: 0
max-same-issues: 0
Expand Down
1 change: 1 addition & 0 deletions breadcrumb_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func (b breadcrumbTransport) RoundTrip(req *http.Request) (*http.Response, error
span := sentry.StartSpan(req.Context(), req.URL.String(), sentry.ContinueFromRequest(req))
defer span.Finish()

//nolint:canonicalheader
req.Header.Add("sentry-trace", span.ToSentryTrace())

breadcrumb := sentry.Breadcrumb{
Expand Down
2 changes: 1 addition & 1 deletion breadcrumb_transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type BreadcrumbTransportSuite struct {
}

func (suite *BreadcrumbTransportSuite) SetupSuite() {
suite.ts = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
suite.ts = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusNoContent)
}))
}
Expand Down
5 changes: 2 additions & 3 deletions doc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package logger

import (
"context"
"fmt"
"net/http"

"github.com/getsentry/sentry-go"
Expand Down Expand Up @@ -50,7 +49,7 @@ func Example_breadcrumbTransport() {
defer resp.Body.Close()

// Or just log response
sentry.CaptureMessage(fmt.Sprintf("Response status: %s", resp.Status))
sentry.CaptureMessage("Response status: " + resp.Status)

// Either way it will contain full info about request in breadcrumb
}
Expand Down Expand Up @@ -92,7 +91,7 @@ func Example_webServer() {
if err != nil {
log.Warn("request failed", zap.Error(err))
} else {
log.Info(fmt.Sprintf("Response status: %s", resp.Status))
log.Info("Response status: " + resp.Status)
resp.Body.Close()
}

Expand Down
4 changes: 2 additions & 2 deletions logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (s *TestLoggerSuite) TestLoggerShouldSendEventToSentryAndReturnEventID() {
eventID = event.EventID
})

wrappedHandler := s.wrapHandler(func(w http.ResponseWriter, r *http.Request) {
wrappedHandler := s.wrapHandler(func(_ http.ResponseWriter, r *http.Request) {
Ctx(r.Context()).Error("test error")
})

Expand All @@ -77,7 +77,7 @@ func (s *TestLoggerSuite) TestLoggerShouldSendEventToSentryAndReturnEventID() {
func (s *TestLoggerSuite) TestLoggerWithInjectedExtraFields() {
s.logger = zap.New(NewSentryCoreWrapper(zapcore.NewNopCore(), sentry.CurrentHub()))

handlerFunc := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
handlerFunc := http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) {
Ctx(r.Context()).Error("test error")
})

Expand Down
4 changes: 2 additions & 2 deletions sentry_core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func (suite *SentryCoreSuite) TestWriteChainedErrors() {
suite.Nil(thread.Stacktrace)
})

err := stderrors.New("simple error")
err := stderrors.New("simple error") //nolint:err113
err = errors.WithStack(err)
err = fmt.Errorf("wrap with fmt.Errorf: %w", err)

Expand All @@ -265,7 +265,7 @@ func (suite *SentryCoreSuite) TestWriteChainedErrors() {
func (suite *SentryCoreSuite) TestStrippingWrappedErrors() {
core := NewSentryCore(suite.hub).(*SentryCore)

err := stderrors.New("simple error")
err := stderrors.New("simple error") //nolint:err113
err = fmt.Errorf("first wrap: %w", err)
err = fmt.Errorf("second wrap: %w", err)

Expand Down

0 comments on commit 8077c33

Please sign in to comment.