-
Notifications
You must be signed in to change notification settings - Fork 517
Expand file tree
/
Copy path.golangci.yml
More file actions
134 lines (133 loc) · 4.22 KB
/
.golangci.yml
File metadata and controls
134 lines (133 loc) · 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
version: "2"
run:
build-tags:
- goexperiment.synctest
issues:
max-same-issues: 0
max-issues-per-linter: 0
linters:
default: none
enable:
- bodyclose
- depguard
- gocritic
- forbidigo
- govet
- modernize
- revive
# - errorlint # TODO: Enable this once we've fixed all the errorlint issues.
# - loggercheck # TODO: Enable this once we've migrated to structured logging.
# - perfsprint # TODO: Enable this once we've fixed all the perfsprint issues.
# - unused # TODO: Enable this once we've fixed all the unused issues.
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
rules:
- path: "internal/(env|log|locking)/"
linters:
- forbidigo
- path: "_test\\.go$"
linters:
- forbidigo
- path-except: "^ddtrace/tracer/"
linters:
- forbidigo
text: "use github.com/DataDog/dd-trace-go/v2/internal/locking\\.(RW)?Mutex instead of sync\\.(RW)?Mutex"
settings:
forbidigo:
forbid:
- pattern: "^os\\.Getenv$"
msg: "use internal/env.Get instead of os.Getenv"
- pattern: "^os\\.LookupEnv$"
msg: "use internal/env.Lookup instead of os.LookupEnv"
- pattern: "sync\\.Mutex"
msg: "use github.com/DataDog/dd-trace-go/v2/internal/locking.Mutex instead of sync.Mutex"
- pattern: "sync\\.RWMutex"
msg: "use github.com/DataDog/dd-trace-go/v2/internal/locking.RWMutex instead of sync.RWMutex"
exclude_godoc_examples: true
analyze_types: true
modernize:
disable:
- newexpr # Requires Go 1.26; our go.mod minimum is 1.25
govet:
enable-all: true
disable:
- fieldalignment
- shadow # TODO: Enable this once we've fixed all the shadowing issues.
depguard:
rules:
main:
list-mode: lax
files:
- $all
- "!**/scripts/**"
- "!**/tools/**"
- "!**/*_test.go"
- "!**/example_test.go"
- "!**/internal/log/log.go"
- "!**/internal/orchestrion/**"
- "!**/instrumentation/testutils/sql/sql.go"
deny:
- pkg: "log"
desc: "Use github.com/DataDog/dd-trace-go/v2/internal/log instead of standard log package"
allow:
- "log/slog"
gocritic:
disable-all: true
enabled-checks:
- dynamicFmtString
- ruleguard
settings:
ruleguard:
failOn: dsl,import
rules: "rules/*_rules.go"
# TODO: Enable this when we migrated to structed logging.
loggercheck:
require-string-key: true
# no-printf-like: true
rules:
- github.com/DataDog/dd-trace-go/v2/internal/telemetry/log.Debug
- github.com/DataDog/dd-trace-go/v2/internal/telemetry/log.Warn
- github.com/DataDog/dd-trace-go/v2/internal/telemetry/log.Error
- github.com/DataDog/dd-trace-go/v2/internal/telemetry/log.Info
- github.com/DataDog/dd-trace-go/v2/internal/log.Debug
- github.com/DataDog/dd-trace-go/v2/internal/log.Warn
- github.com/DataDog/dd-trace-go/v2/internal/log.Error
- github.com/DataDog/dd-trace-go/v2/internal/log.Info
- (github.com/DataDog/dd-trace-go/v2/instrumentation.Logger).Debug
- (github.com/DataDog/dd-trace-go/v2/instrumentation.Logger).Info
- (github.com/DataDog/dd-trace-go/v2/instrumentation.Logger).Warn
- (github.com/DataDog/dd-trace-go/v2/instrumentation.Logger).Error
revive:
rules:
- name: var-naming
severity: warning
disabled: false
exclude: [""]
arguments:
- [""] # AllowList
- [""] # DenyList
# NOTICE: Allowlisting "utils" package name, doesn't work. Needs investigation.
- - skip-package-name-checks: true # Extra parameter
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
settings:
goimports:
local-prefixes:
- github.com/DataDog/dd-trace-go/v2