Skip to content

Commit

Permalink
chore: lint (#49)
Browse files Browse the repository at this point in the history
Signed-off-by: Cattī Crūdēlēs <[email protected]>
  • Loading branch information
wzy9607 authored Aug 31, 2024
1 parent 79ff168 commit 140e020
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
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

0 comments on commit 140e020

Please sign in to comment.