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: lint #49

Merged
merged 1 commit into from
Aug 31, 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
34 changes: 18 additions & 16 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
run:
timeout: 10m
show-stats: true

output:
sort-results: true
show-stats: true

linters-settings:
cyclop:
Expand All @@ -24,13 +24,18 @@ linters-settings:
- switch
- map
default-signifies-exhaustive: true
funlen:
lines: 100
statements: 80
gci:
sections:
- standard
- default
- prefix(github.com/rabbitmq/amqp091-go)
- prefix(github.com/wzy9607/amqp091otel)
- localmodule
custom-order: true
gocognit:
min-complexity: 20
gocritic:
enabled-tags:
- diagnostic
Expand All @@ -40,11 +45,12 @@ linters-settings:
- opinionated
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- emptyStringTest
- hugeParam
- ifElseChain
- ruleguard
- sloppyReassign
- whyNoLint
- whyNoLint # nolintlint is better
settings:
captLocal:
paramsOnly: false
Expand All @@ -57,21 +63,20 @@ linters-settings:
replacement: "any"
- pattern: "a[b:len(a)]"
replacement: "a[b:]"
gomnd:
govet:
enable-all: true
disable:
- fieldalignment
grouper:
import-require-single-import: true
mnd:
checks:
- argument
- case
- condition
- return
ignored-functions:
- strings.SplitN
govet:
check-shadowing: true
enable-all: true
disable:
- fieldalignment
grouper:
import-require-single-import: true
nakedret:
max-func-lines: 50
nolintlint:
Expand Down Expand Up @@ -119,11 +124,9 @@ linters-settings:
time-layout: true
crypto-hash: true
default-rpc-path: true
os-dev-null: true
sql-isolation-level: true
tls-signature-scheme: true
constant-kind: true
syslog-priority: true
varnamelen:
max-distance: 10

Expand Down Expand Up @@ -154,7 +157,6 @@ linters:
- gocritic
- gofmt
- gofumpt
- gomnd
- gomoddirectives
- gosec
- gosimple
Expand All @@ -168,6 +170,7 @@ linters:
- makezero
- mirror
- misspell
- mnd
- musttag
- nakedret
- nestif
Expand Down Expand Up @@ -198,7 +201,6 @@ linters:
- wastedassign
- whitespace


issues:
include:
- EXC0003
Expand All @@ -214,7 +216,7 @@ issues:
- exhaustruct
- forcetypeassert
- funlen
- gomnd
- mnd
- nakedret
- spancheck
- varnamelen
Expand Down
1 change: 1 addition & 0 deletions channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func (ch *Channel) startConsumerSpan(msg *amqp091.Delivery, queue string, operat
attrs = append(attrs, semconv.MessagingMessageID(msg.MessageId))
}
if msg.DeliveryTag != 0 {
//nolint:gosec // overflow here is relatively safe and unlikely to happen
attrs = append(attrs, semconv.MessagingRabbitmqMessageDeliveryTag(int(msg.DeliveryTag)))
}
attrs = append(attrs, ch.commonAttrs()...)
Expand Down
Loading