Skip to content

Commit 3084f44

Browse files
committed
chore: update implementation
1 parent 164f441 commit 3084f44

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

.golangci.next.reference.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2051,7 +2051,13 @@ linters-settings:
20512051
# Default: []
20522052
ignore-check-signatures:
20532053
- "telemetry.RecordError"
2054-
2054+
# A list of regexes for additional function signatures that create spans.
2055+
# This is useful if you have a utility method to create spans.
2056+
# Each entry should be of the form `<regex>:<telemetry-type>`, where `telemetry-type` can be `opentelemetry` or `opencensus`.
2057+
# https://github.com/jjti/go-spancheck#extra-start-span-signatures
2058+
# Default: []
2059+
extra-start-span-signatures:
2060+
- "github.com/user/repo/telemetry/trace.Start:opentelemetry"
20552061
staticcheck:
20562062
# Deprecated: use the global `run.go` instead.
20572063
go: "1.15"

jsonschema/golangci.next.jsonschema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,6 +2337,13 @@
23372337
"items": {
23382338
"type": "string"
23392339
}
2340+
},
2341+
"extra-start-span-signatures": {
2342+
"description": "A list of regexes for additional function signatures that create spans.",
2343+
"type": "array",
2344+
"items": {
2345+
"type": "string"
2346+
}
23402347
}
23412348
}
23422349
},

pkg/config/linters_settings.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,8 +823,9 @@ type SlogLintSettings struct {
823823
}
824824

825825
type SpancheckSettings struct {
826-
Checks []string `mapstructure:"checks"`
827-
IgnoreCheckSignatures []string `mapstructure:"ignore-check-signatures"`
826+
Checks []string `mapstructure:"checks"`
827+
IgnoreCheckSignatures []string `mapstructure:"ignore-check-signatures"`
828+
ExtraStartSpanSignatures []string `mapstructure:"extra-start-span-signatures"`
828829
}
829830

830831
type StaticCheckSettings struct {

pkg/golinters/spancheck/spancheck.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ func New(settings *config.SpancheckSettings) *goanalysis.Linter {
1919
if settings.IgnoreCheckSignatures != nil {
2020
cfg.IgnoreChecksSignaturesSlice = settings.IgnoreCheckSignatures
2121
}
22+
23+
if settings.ExtraStartSpanSignatures != nil {
24+
cfg.StartSpanMatchersSlice = settings.ExtraStartSpanSignatures
25+
}
2226
}
2327

2428
a := spancheck.NewAnalyzerWithConfig(cfg)

0 commit comments

Comments
 (0)