From 59a99f9e6ce02c02a47d835e8018de77ecf1cc60 Mon Sep 17 00:00:00 2001 From: Joshua Timmons Date: Thu, 28 Dec 2023 18:21:38 -0500 Subject: [PATCH 01/20] Init addition of spancheck --- .golangci.reference.yml | 36 ++++++++++++++++++++++++++++++++++ go.mod | 3 ++- go.sum | 4 ++++ pkg/config/linters_settings.go | 20 ++++++++++++++----- pkg/golinters/spancheck.go | 29 +++++++++++++++++++++++++++ pkg/lint/lintersdb/manager.go | 12 ++++++++++-- test/testdata/spancheck.go | 2 ++ 7 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 pkg/golinters/spancheck.go create mode 100644 test/testdata/spancheck.go diff --git a/.golangci.reference.yml b/.golangci.reference.yml index f24a96ad6915..7a314500da3f 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -1904,6 +1904,42 @@ linters-settings: # Default: false args-on-sep-lines: true + spancheck: + # Enable all checks. This overrides individual check settings. + # Default: false + enable-all: false + + # Disable the span.End() check. + # Default: false + disable-end-check: false + + # Enables a check that `span.SetStatus` is called whenever a path to a return statement with an error + # is found. Developers should use `span.SetStatus(codes.Error, msg)` to set the `status:error` attribute + # on the span. + # https://github.com/jjti/go-spancheck#checks + # Default: false + enable-set-status-check: true + + # A slice of regexes for function signatures that, if found in the call path to an error return statement, + # should silence the SetStatus check. + # https://github.com/jjti/go-spancheck#configuration + # Default: [] + ignore-set-status-check-signatures: + - "telemetry.RecordError" + + # Enables a check that `span.RecordError` is called whenever a path to a return statement with an error + # is found. Developers should use `span.RecordError(err)` to create an exception event on the span. + # https://github.com/jjti/go-spancheck#checks + # Default: false + enable-record-error-check: true + + # A slice of regexes for function signatures that, if found in the call path to an error return statement, + # should silence the RecordError check. + # https://github.com/jjti/go-spancheck#configuration + # Default: [] + ignore-record-error-check-signatures: + - "telemetry.RecordError" + staticcheck: # Deprecated: use the global `run.go` instead. go: "1.15" diff --git a/go.mod b/go.mod index 6ec9138f5b6b..61761091121a 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/golangci/golangci-lint -go 1.20 +go 1.21.3 require ( 4d63.com/gocheckcompilerdirectives v1.2.1 @@ -157,6 +157,7 @@ require ( github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jjti/go-spancheck v0.3.0 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/magiconair/properties v1.8.6 // indirect diff --git a/go.sum b/go.sum index dc7503e7db73..40e0d21790b4 100644 --- a/go.sum +++ b/go.sum @@ -314,6 +314,10 @@ github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjz github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= +github.com/jjti/go-spancheck v0.2.0 h1:vhwZJnmQt9qBw8xdqiZ7UWKTn2Ag8kh7/zq3seZ+nkI= +github.com/jjti/go-spancheck v0.2.0/go.mod h1:Y9m3q/eWmAvoVPgWM/H2Ce+Y+TiCcqDAfTKfFXMW274= +github.com/jjti/go-spancheck v0.3.0 h1:oWmVdpDu56H0Yj9osysJBoFqIpNyxFxIRkN0mFD1HO0= +github.com/jjti/go-spancheck v0.3.0/go.mod h1:Y9m3q/eWmAvoVPgWM/H2Ce+Y+TiCcqDAfTKfFXMW274= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index a79a2a61e681..8b2ff32ae4b5 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -186,10 +186,10 @@ type LintersSettings struct { Decorder DecorderSettings Depguard DepGuardSettings Dogsled DogsledSettings - Dupl DuplSettings DupWord DupWordSettings - Errcheck ErrcheckSettings + Dupl DuplSettings ErrChkJSON ErrChkJSONSettings + Errcheck ErrcheckSettings ErrorLint ErrorLintSettings Exhaustive ExhaustiveSettings ExhaustiveStruct ExhaustiveStructSettings @@ -198,6 +198,7 @@ type LintersSettings struct { Funlen FunlenSettings Gci GciSettings GinkgoLinter GinkgoLinterSettings + GoModDirectives GoModDirectivesSettings Gocognit GocognitSettings Goconst GoConstSettings Gocritic GoCriticSettings @@ -210,7 +211,6 @@ type LintersSettings struct { Goimports GoImportsSettings Golint GoLintSettings Gomnd GoMndSettings - GoModDirectives GoModDirectivesSettings Gomodguard GoModGuardSettings Gosec GoSecSettings Gosimple StaticCheckSettings @@ -245,13 +245,14 @@ type LintersSettings struct { Revive ReviveSettings RowsErrCheck RowsErrCheckSettings SlogLint SlogLintSettings + Spancheck SpancheckSettings Staticcheck StaticCheckSettings Structcheck StructCheckSettings Stylecheck StaticCheckSettings TagAlign TagAlignSettings Tagliatelle TagliatelleSettings - Testifylint TestifylintSettings Tenv TenvSettings + Testifylint TestifylintSettings Testpackage TestpackageSettings Thelper ThelperSettings Unparam UnparamSettings @@ -259,9 +260,9 @@ type LintersSettings struct { UseStdlibVars UseStdlibVarsSettings Varcheck VarCheckSettings Varnamelen VarnamelenSettings + WSL WSLSettings Whitespace WhitespaceSettings Wrapcheck WrapcheckSettings - WSL WSLSettings Custom map[string]CustomLinterSettings } @@ -773,6 +774,15 @@ type SlogLintSettings struct { ArgsOnSepLines bool `mapstructure:"args-on-sep-lines"` } +type SpancheckSettings struct { + DisableEndCheck bool `mapstructure:"disable-end-check"` + EnableAll bool `mapstructure:"enable-all"` + EnableRecordErrorCheck bool `mapstructure:"enable-record-error-check"` + EnableSetStatusCheck bool `mapstructure:"enable-set-status-check"` + IgnoreRecordErrorCheckSignatures []string `mapstructure:"ignore-record-error-check-signatures"` + IgnoreSetStatusCheckSignatures []string `mapstructure:"ignore-set-status-check-signatures"` +} + type StaticCheckSettings struct { // Deprecated: use the global `run.go` instead. GoVersion string `mapstructure:"go"` diff --git a/pkg/golinters/spancheck.go b/pkg/golinters/spancheck.go new file mode 100644 index 000000000000..377635b29639 --- /dev/null +++ b/pkg/golinters/spancheck.go @@ -0,0 +1,29 @@ +package golinters + +import ( + "github.com/jjti/go-spancheck" + "golang.org/x/tools/go/analysis" + + "github.com/golangci/golangci-lint/pkg/config" + "github.com/golangci/golangci-lint/pkg/golinters/goanalysis" +) + +func NewSpancheck(settings *config.SpancheckSettings) *goanalysis.Linter { + cfg := &spancheck.Config{} + if settings != nil { + cfg = &spancheck.Config{ + DisableEndCheck: settings.DisableEndCheck, + EnableAll: settings.EnableAll, + EnableRecordErrorCheck: settings.EnableRecordErrorCheck, + EnableSetStatusCheck: settings.EnableSetStatusCheck, + IgnoreRecordErrorCheckSignaturesSlice: settings.IgnoreRecordErrorCheckSignatures, + IgnoreSetStatusCheckSignaturesSlice: settings.IgnoreSetStatusCheckSignatures, + } + } + + a := spancheck.NewAnalyzerWithConfig(cfg) + + return goanalysis. + NewLinter(a.Name, a.Doc, []*analysis.Analyzer{a}, nil). + WithLoadMode(goanalysis.LoadModeTypesInfo) +} diff --git a/pkg/lint/lintersdb/manager.go b/pkg/lint/lintersdb/manager.go index c4e222493d5e..4b33a5280676 100644 --- a/pkg/lint/lintersdb/manager.go +++ b/pkg/lint/lintersdb/manager.go @@ -131,6 +131,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { reviveCfg *config.ReviveSettings rowserrcheckCfg *config.RowsErrCheckSettings sloglintCfg *config.SlogLintSettings + spancheckCfg *config.SpancheckSettings staticcheckCfg *config.StaticCheckSettings structcheckCfg *config.StructCheckSettings stylecheckCfg *config.StaticCheckSettings @@ -169,6 +170,8 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { funlenCfg = &m.cfg.LintersSettings.Funlen gciCfg = &m.cfg.LintersSettings.Gci ginkgolinterCfg = &m.cfg.LintersSettings.GinkgoLinter + goMndCfg = &m.cfg.LintersSettings.Gomnd + goModDirectivesCfg = &m.cfg.LintersSettings.GoModDirectives gocognitCfg = &m.cfg.LintersSettings.Gocognit goconstCfg = &m.cfg.LintersSettings.Goconst gocriticCfg = &m.cfg.LintersSettings.Gocritic @@ -180,8 +183,6 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { goheaderCfg = &m.cfg.LintersSettings.Goheader goimportsCfg = &m.cfg.LintersSettings.Goimports golintCfg = &m.cfg.LintersSettings.Golint - goMndCfg = &m.cfg.LintersSettings.Gomnd - goModDirectivesCfg = &m.cfg.LintersSettings.GoModDirectives gomodguardCfg = &m.cfg.LintersSettings.Gomodguard gosecCfg = &m.cfg.LintersSettings.Gosec gosimpleCfg = &m.cfg.LintersSettings.Gosimple @@ -216,6 +217,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { reviveCfg = &m.cfg.LintersSettings.Revive rowserrcheckCfg = &m.cfg.LintersSettings.RowsErrCheck sloglintCfg = &m.cfg.LintersSettings.SlogLint + spancheckCfg = &m.cfg.LintersSettings.Spancheck staticcheckCfg = &m.cfg.LintersSettings.Staticcheck structcheckCfg = &m.cfg.LintersSettings.Structcheck stylecheckCfg = &m.cfg.LintersSettings.Stylecheck @@ -782,6 +784,12 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { WithLoadForGoAnalysis(). WithURL("https://github.com/ryanrolds/sqlclosecheck"), + linter.NewConfig(golinters.NewSpancheck(spancheckCfg)). + WithSince("v1.56.0"). + WithLoadForGoAnalysis(). + WithPresets(linter.PresetBugs). + WithURL("https://github.com/jjti/go-spancheck"), + linter.NewConfig(golinters.NewStaticcheck(staticcheckCfg)). WithEnabledByDefault(). WithSince("v1.0.0"). diff --git a/test/testdata/spancheck.go b/test/testdata/spancheck.go new file mode 100644 index 000000000000..06d3517224ae --- /dev/null +++ b/test/testdata/spancheck.go @@ -0,0 +1,2 @@ +//golangcitest:args -Espancheck +package testdata From 045d22b6c3f594c82be5e6e211e7ce334cb06954 Mon Sep 17 00:00:00 2001 From: Joshua Timmons Date: Sat, 30 Dec 2023 11:30:45 -0500 Subject: [PATCH 02/20] Bump spancheck --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 94e179a779ad..021869b47db7 100644 --- a/go.mod +++ b/go.mod @@ -155,7 +155,7 @@ require ( github.com/gostaticanalysis/comment v1.4.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jjti/go-spancheck v0.3.0 // indirect + github.com/jjti/go-spancheck v0.3.1 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/magiconair/properties v1.8.6 // indirect diff --git a/go.sum b/go.sum index 4661ca0f8b43..2c650eb80026 100644 --- a/go.sum +++ b/go.sum @@ -314,6 +314,8 @@ github.com/jjti/go-spancheck v0.2.0 h1:vhwZJnmQt9qBw8xdqiZ7UWKTn2Ag8kh7/zq3seZ+n github.com/jjti/go-spancheck v0.2.0/go.mod h1:Y9m3q/eWmAvoVPgWM/H2Ce+Y+TiCcqDAfTKfFXMW274= github.com/jjti/go-spancheck v0.3.0 h1:oWmVdpDu56H0Yj9osysJBoFqIpNyxFxIRkN0mFD1HO0= github.com/jjti/go-spancheck v0.3.0/go.mod h1:Y9m3q/eWmAvoVPgWM/H2Ce+Y+TiCcqDAfTKfFXMW274= +github.com/jjti/go-spancheck v0.3.1 h1:3GjJONve4cy/ifYExxGbE6r6LwaISe9EOC5m5BAwpsg= +github.com/jjti/go-spancheck v0.3.1/go.mod h1:ARPNI1JRG1V2Rjnd6/2f2NEfghjSVDZGVmruNKlnXU0= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= From 9291c62a14832ba48349fe676d1799c86b057164 Mon Sep 17 00:00:00 2001 From: Joshua Timmons Date: Sat, 30 Dec 2023 11:38:26 -0500 Subject: [PATCH 03/20] Revert go mod bump --- go.mod | 4 ++-- go.sum | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 021869b47db7..730799ae3cc0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/golangci/golangci-lint -go 1.21.3 +go 1.20.0 require ( 4d63.com/gocheckcompilerdirectives v1.2.1 @@ -57,6 +57,7 @@ require ( github.com/jgautheron/goconst v1.7.0 github.com/jingyugao/rowserrcheck v1.1.1 github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af + github.com/jjti/go-spancheck v0.3.1 github.com/julz/importas v0.1.0 github.com/kisielk/errcheck v1.6.3 github.com/kkHAIKE/contextcheck v1.1.4 @@ -155,7 +156,6 @@ require ( github.com/gostaticanalysis/comment v1.4.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jjti/go-spancheck v0.3.1 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/magiconair/properties v1.8.6 // indirect diff --git a/go.sum b/go.sum index 2c650eb80026..b6e70260bbdc 100644 --- a/go.sum +++ b/go.sum @@ -310,10 +310,6 @@ github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjz github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= -github.com/jjti/go-spancheck v0.2.0 h1:vhwZJnmQt9qBw8xdqiZ7UWKTn2Ag8kh7/zq3seZ+nkI= -github.com/jjti/go-spancheck v0.2.0/go.mod h1:Y9m3q/eWmAvoVPgWM/H2Ce+Y+TiCcqDAfTKfFXMW274= -github.com/jjti/go-spancheck v0.3.0 h1:oWmVdpDu56H0Yj9osysJBoFqIpNyxFxIRkN0mFD1HO0= -github.com/jjti/go-spancheck v0.3.0/go.mod h1:Y9m3q/eWmAvoVPgWM/H2Ce+Y+TiCcqDAfTKfFXMW274= github.com/jjti/go-spancheck v0.3.1 h1:3GjJONve4cy/ifYExxGbE6r6LwaISe9EOC5m5BAwpsg= github.com/jjti/go-spancheck v0.3.1/go.mod h1:ARPNI1JRG1V2Rjnd6/2f2NEfghjSVDZGVmruNKlnXU0= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= From c2e6c307c7a472ac446a1e6d41f8091a6b72d9bb Mon Sep 17 00:00:00 2001 From: Joshua Timmons Date: Sat, 30 Dec 2023 11:42:09 -0500 Subject: [PATCH 04/20] Add to enable/disable, re-order settings --- .golangci.reference.yml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 7a314500da3f..ba4aca17b264 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -1905,13 +1905,19 @@ linters-settings: args-on-sep-lines: true spancheck: + # Disable the span.End() check. + # Default: false + disable-end-check: true + # Enable all checks. This overrides individual check settings. # Default: false - enable-all: false + enable-all: true - # Disable the span.End() check. + # Enables a check that `span.RecordError` is called whenever a path to a return statement with an error + # is found. Developers should use `span.RecordError(err)` to create an exception event on the span. + # https://github.com/jjti/go-spancheck#checks # Default: false - disable-end-check: false + enable-record-error-check: true # Enables a check that `span.SetStatus` is called whenever a path to a return statement with an error # is found. Developers should use `span.SetStatus(codes.Error, msg)` to set the `status:error` attribute @@ -1921,23 +1927,17 @@ linters-settings: enable-set-status-check: true # A slice of regexes for function signatures that, if found in the call path to an error return statement, - # should silence the SetStatus check. + # should silence the RecordError check. # https://github.com/jjti/go-spancheck#configuration # Default: [] - ignore-set-status-check-signatures: + ignore-record-error-check-signatures: - "telemetry.RecordError" - # Enables a check that `span.RecordError` is called whenever a path to a return statement with an error - # is found. Developers should use `span.RecordError(err)` to create an exception event on the span. - # https://github.com/jjti/go-spancheck#checks - # Default: false - enable-record-error-check: true - # A slice of regexes for function signatures that, if found in the call path to an error return statement, - # should silence the RecordError check. + # should silence the SetStatus check. # https://github.com/jjti/go-spancheck#configuration # Default: [] - ignore-record-error-check-signatures: + ignore-set-status-check-signatures: - "telemetry.RecordError" staticcheck: @@ -2470,6 +2470,7 @@ linters: - rowserrcheck - scopelint - sloglint + - spancheck - sqlclosecheck - staticcheck - structcheck @@ -2590,6 +2591,7 @@ linters: - rowserrcheck - scopelint - sloglint + - spancheck - sqlclosecheck - staticcheck - structcheck From f755b1285d81f1e5a610a9757125fec75173d191 Mon Sep 17 00:00:00 2001 From: Joshua Timmons Date: Sat, 30 Dec 2023 12:40:59 -0500 Subject: [PATCH 05/20] Create test module --- go.mod | 3 +- go.sum | 7 +- test/linters_test.go | 1 + test/testdata/spancheck.go | 2 - .../testdata/spancheck/configs/enable_all.yml | 7 + test/testdata/spancheck/go.mod | 14 ++ test/testdata/spancheck/go.sum | 16 ++ test/testdata/spancheck/spancheck.go | 206 ++++++++++++++++++ 8 files changed, 250 insertions(+), 6 deletions(-) delete mode 100644 test/testdata/spancheck.go create mode 100644 test/testdata/spancheck/configs/enable_all.yml create mode 100644 test/testdata/spancheck/go.mod create mode 100644 test/testdata/spancheck/go.sum create mode 100644 test/testdata/spancheck/spancheck.go diff --git a/go.mod b/go.mod index 730799ae3cc0..7e728f1fe163 100644 --- a/go.mod +++ b/go.mod @@ -57,7 +57,7 @@ require ( github.com/jgautheron/goconst v1.7.0 github.com/jingyugao/rowserrcheck v1.1.1 github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af - github.com/jjti/go-spancheck v0.3.1 + github.com/jjti/go-spancheck v0.3.2 github.com/julz/importas v0.1.0 github.com/kisielk/errcheck v1.6.3 github.com/kkHAIKE/contextcheck v1.1.4 @@ -141,6 +141,7 @@ require ( github.com/ettle/strcase v0.2.0 // indirect github.com/fatih/structtag v1.2.0 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect diff --git a/go.sum b/go.sum index b6e70260bbdc..5894ee97e128 100644 --- a/go.sum +++ b/go.sum @@ -165,7 +165,8 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -310,8 +311,8 @@ github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjz github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= -github.com/jjti/go-spancheck v0.3.1 h1:3GjJONve4cy/ifYExxGbE6r6LwaISe9EOC5m5BAwpsg= -github.com/jjti/go-spancheck v0.3.1/go.mod h1:ARPNI1JRG1V2Rjnd6/2f2NEfghjSVDZGVmruNKlnXU0= +github.com/jjti/go-spancheck v0.3.2 h1:uGPxQ5pWa7WIcA4BfTgUyu1pMXroLzqrveslf7c6NOM= +github.com/jjti/go-spancheck v0.3.2/go.mod h1:ARPNI1JRG1V2Rjnd6/2f2NEfghjSVDZGVmruNKlnXU0= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= diff --git a/test/linters_test.go b/test/linters_test.go index 75d4f44adf1d..1019a1f09c42 100644 --- a/test/linters_test.go +++ b/test/linters_test.go @@ -33,6 +33,7 @@ func TestSourcesFromTestdataSubDir(t *testing.T) { "ginkgolinter", "zerologlint", "protogetter", + "spancheck", } for _, dir := range subDirs { diff --git a/test/testdata/spancheck.go b/test/testdata/spancheck.go deleted file mode 100644 index 06d3517224ae..000000000000 --- a/test/testdata/spancheck.go +++ /dev/null @@ -1,2 +0,0 @@ -//golangcitest:args -Espancheck -package testdata diff --git a/test/testdata/spancheck/configs/enable_all.yml b/test/testdata/spancheck/configs/enable_all.yml new file mode 100644 index 000000000000..c84fecba42b6 --- /dev/null +++ b/test/testdata/spancheck/configs/enable_all.yml @@ -0,0 +1,7 @@ +linters-settings: + spancheck: + enable-all: true + ignore-record-error-check-signatures: + - "recordErr" + ignore-set-status-check-signatures: + - "recordErr" diff --git a/test/testdata/spancheck/go.mod b/test/testdata/spancheck/go.mod new file mode 100644 index 000000000000..7173b7947e63 --- /dev/null +++ b/test/testdata/spancheck/go.mod @@ -0,0 +1,14 @@ +module spancheck + +go 1.20.0 + +require ( + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 +) + +require ( + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect +) diff --git a/test/testdata/spancheck/go.sum b/test/testdata/spancheck/go.sum new file mode 100644 index 000000000000..e09fe7a75588 --- /dev/null +++ b/test/testdata/spancheck/go.sum @@ -0,0 +1,16 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/test/testdata/spancheck/spancheck.go b/test/testdata/spancheck/spancheck.go new file mode 100644 index 000000000000..c4075200406b --- /dev/null +++ b/test/testdata/spancheck/spancheck.go @@ -0,0 +1,206 @@ +//golangcitest:config_path configs/enable_all.yml +//golangcitest:args --disable-all -Espancheck +package spancheck + +import ( + "context" + "errors" + "fmt" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" +) + +type testError struct{} + +func (e *testError) Error() string { + return "foo" +} + +// incorrect + +func _() { + otel.Tracer("foo").Start(context.Background(), "bar") // want "span is unassigned, probable memory leak" + ctx, _ := otel.Tracer("foo").Start(context.Background(), "bar") // want "span is unassigned, probable memory leak" + fmt.Print(ctx) +} + +func _() { + ctx, span := otel.Tracer("foo").Start(context.Background(), "bar") // want "span.End is not called on all paths, possible memory leak" + print(ctx.Done(), span.IsRecording()) +} // want "return can be reached without calling span.End" + +func _() { + var ctx, span = otel.Tracer("foo").Start(context.Background(), "bar") // want "span.End is not called on all paths, possible memory leak" + print(ctx.Done(), span.IsRecording()) +} // want "return can be reached without calling span.End" + +func _() { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") // want "span.End is not called on all paths, possible memory leak" + _, span = otel.Tracer("foo").Start(context.Background(), "bar") + fmt.Print(span) + defer span.End() +} // want "return can be reached without calling span.End" + +func _() error { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") // want "span.SetStatus is not called on all paths" + defer span.End() + + if true { + err := errors.New("foo") + span.RecordError(err) + return err // want "return can be reached without calling span.SetStatus" + } + + return nil +} + +func _() error { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") // want "span.SetStatus is not called on all paths" + defer span.End() + + if true { + span.RecordError(errors.New("foo")) + return errors.New("foo") // want "return can be reached without calling span.SetStatus" + } + + return nil +} + +func _() error { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") // want "span.SetStatus is not called on all paths" + defer span.End() + + if true { + span.RecordError(errors.New("foo")) + return &testError{} // want "return can be reached without calling span.SetStatus" + } + + return nil +} + +func _() error { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") // want "span.RecordError is not called on all paths" + defer span.End() + + if true { + span.SetStatus(codes.Error, "foo") + return &testError{} // want "return can be reached without calling span.RecordError" + } + + return nil +} + +func _() (string, error) { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") // want "span.SetStatus is not called on all paths" + defer span.End() + + if true { + span.RecordError(errors.New("foo")) + return "", &testError{} // want "return can be reached without calling span.SetStatus" + } + + return "", nil +} + +func _() (string, error) { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") // want "span.SetStatus is not called on all paths" + defer span.End() + + if true { + span.RecordError(errors.New("foo")) + return "", errors.New("foo") // want "return can be reached without calling span.SetStatus" + } + + return "", nil +} + +func _() { + f := func() error { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") // want "span.SetStatus is not called on all paths" + defer span.End() + + if true { + span.RecordError(errors.New("foo")) + return errors.New("foo") // want "return can be reached without calling span.SetStatus" + } + + return nil + } + fmt.Println(f) +} + +func _() error { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") // want "span.SetStatus is not called on all paths" + defer span.End() + + { + if true { + span.RecordError(errors.New("foo")) + return errors.New("foo") // want "return can be reached without calling span.SetStatus" + } + } + + return nil +} + +// correct + +func _() error { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") + defer span.End() + + return nil +} + +func _() error { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") + defer span.End() + + if true { + return nil + } + + return nil +} + +func _() error { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") + defer span.End() + + if false { + err := errors.New("foo") + span.SetStatus(codes.Error, err.Error()) + span.RecordError(err) + return err + } + + if true { + span.SetStatus(codes.Error, "foo") + span.RecordError(errors.New("foo")) + return errors.New("bar") + } + + return nil +} + +func _() { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") + defer span.End() + + _, span = otel.Tracer("foo").Start(context.Background(), "bar") + defer span.End() +} + +// ignore error because of matching func sig +func _() error { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") + defer span.End() + + err := errors.New("foo") + recordErr(span, err) + return err +} + +func recordErr(span trace.Span, err error) {} From 9e6ce37cbf991898316535c29454d14d207b10c5 Mon Sep 17 00:00:00 2001 From: Joshua Timmons Date: Sat, 30 Dec 2023 12:43:19 -0500 Subject: [PATCH 06/20] Fix mod version again --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 7e728f1fe163..19d090ee9e2b 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/golangci/golangci-lint -go 1.20.0 +go 1.20 require ( 4d63.com/gocheckcompilerdirectives v1.2.1 From df97e7cc30e615e2bd518aa44a0ca5341ef461e6 Mon Sep 17 00:00:00 2001 From: Joshua Timmons Date: Tue, 2 Jan 2024 14:19:10 -0500 Subject: [PATCH 07/20] Bump go-spancheck --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0e2c3e97c407..e02956f920d2 100644 --- a/go.mod +++ b/go.mod @@ -57,7 +57,7 @@ require ( github.com/jgautheron/goconst v1.7.0 github.com/jingyugao/rowserrcheck v1.1.1 github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af - github.com/jjti/go-spancheck v0.3.2 + github.com/jjti/go-spancheck v0.3.3 github.com/julz/importas v0.1.0 github.com/kisielk/errcheck v1.6.3 github.com/kkHAIKE/contextcheck v1.1.4 diff --git a/go.sum b/go.sum index 2d58fbe4ce25..456e97f6e826 100644 --- a/go.sum +++ b/go.sum @@ -311,8 +311,8 @@ github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjz github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= -github.com/jjti/go-spancheck v0.3.2 h1:uGPxQ5pWa7WIcA4BfTgUyu1pMXroLzqrveslf7c6NOM= -github.com/jjti/go-spancheck v0.3.2/go.mod h1:ARPNI1JRG1V2Rjnd6/2f2NEfghjSVDZGVmruNKlnXU0= +github.com/jjti/go-spancheck v0.3.3 h1:E1a7H9DM2EBySR4iYrRiQK46pqlc2EGVmGpwg4VvH6Y= +github.com/jjti/go-spancheck v0.3.3/go.mod h1:ARPNI1JRG1V2Rjnd6/2f2NEfghjSVDZGVmruNKlnXU0= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= From 01780df3167aa5853115313936a4a6dce033059e Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 2 Jan 2024 21:16:48 +0100 Subject: [PATCH 08/20] review: remove useless indirect requirement --- go.mod | 1 - go.sum | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f3322893e52b..b130ebb53838 100644 --- a/go.mod +++ b/go.mod @@ -141,7 +141,6 @@ require ( github.com/ettle/strcase v0.2.0 // indirect github.com/fatih/structtag v1.2.0 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect - github.com/go-logr/logr v1.3.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect diff --git a/go.sum b/go.sum index 0be8d3fc9815..1520a82c6b30 100644 --- a/go.sum +++ b/go.sum @@ -165,8 +165,7 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= From 6884970eef3501a7f464bb768f8aa9361297d89d Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 2 Jan 2024 21:20:33 +0100 Subject: [PATCH 09/20] review: restore linter settings order --- pkg/config/linters_settings.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index 8b2ff32ae4b5..3ec004f1eed0 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -198,7 +198,6 @@ type LintersSettings struct { Funlen FunlenSettings Gci GciSettings GinkgoLinter GinkgoLinterSettings - GoModDirectives GoModDirectivesSettings Gocognit GocognitSettings Goconst GoConstSettings Gocritic GoCriticSettings @@ -211,6 +210,7 @@ type LintersSettings struct { Goimports GoImportsSettings Golint GoLintSettings Gomnd GoMndSettings + GoModDirectives GoModDirectivesSettings Gomodguard GoModGuardSettings Gosec GoSecSettings Gosimple StaticCheckSettings @@ -260,9 +260,9 @@ type LintersSettings struct { UseStdlibVars UseStdlibVarsSettings Varcheck VarCheckSettings Varnamelen VarnamelenSettings - WSL WSLSettings Whitespace WhitespaceSettings Wrapcheck WrapcheckSettings + WSL WSLSettings Custom map[string]CustomLinterSettings } From 9b379e58026dc9a8a1f82115e521a27be17b954d Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 2 Jan 2024 21:29:32 +0100 Subject: [PATCH 10/20] review: realitic Go version and fix test args --- test/testdata/spancheck/go.mod | 2 +- test/testdata/spancheck/spancheck.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/testdata/spancheck/go.mod b/test/testdata/spancheck/go.mod index 7173b7947e63..de347098a901 100644 --- a/test/testdata/spancheck/go.mod +++ b/test/testdata/spancheck/go.mod @@ -1,6 +1,6 @@ module spancheck -go 1.20.0 +go 1.20 require ( go.opentelemetry.io/otel v1.21.0 diff --git a/test/testdata/spancheck/spancheck.go b/test/testdata/spancheck/spancheck.go index c4075200406b..f824add32b26 100644 --- a/test/testdata/spancheck/spancheck.go +++ b/test/testdata/spancheck/spancheck.go @@ -1,5 +1,5 @@ //golangcitest:config_path configs/enable_all.yml -//golangcitest:args --disable-all -Espancheck +//golangcitest:args -Espancheck package spancheck import ( From be44eb12944892dc8dad1a2a8a3851e26bc464c7 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 2 Jan 2024 21:36:09 +0100 Subject: [PATCH 11/20] review: Semantic Line Breaks --- .golangci.reference.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index c54e75c4dfc4..dde175ca6b10 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -1917,24 +1917,25 @@ linters-settings: # Default: false disable-end-check: true - # Enable all checks. This overrides individual check settings. + # Enable all checks. + # This overrides individual check settings. # Default: false enable-all: true - # Enables a check that `span.RecordError` is called whenever a path to a return statement with an error - # is found. Developers should use `span.RecordError(err)` to create an exception event on the span. + # Enables a check that `span.RecordError` is called whenever a path to a return statement with an error is found. + # Developers should use `span.RecordError(err)` to create an exception event on the span. # https://github.com/jjti/go-spancheck#checks # Default: false enable-record-error-check: true - # Enables a check that `span.SetStatus` is called whenever a path to a return statement with an error - # is found. Developers should use `span.SetStatus(codes.Error, msg)` to set the `status:error` attribute - # on the span. + # Enables a check that `span.SetStatus` is called whenever a path to a return statement with an error is found. + # Developers should use `span.SetStatus(codes.Error, msg)` to set the `status:error` attribute on the span. # https://github.com/jjti/go-spancheck#checks # Default: false enable-set-status-check: true - # A slice of regexes for function signatures that, if found in the call path to an error return statement, + # A slice of regexes for function signatures that, + # if found in the call path to an error return statement, # should silence the RecordError check. # https://github.com/jjti/go-spancheck#configuration # Default: [] From fe8c8c69d8e9bef48bd33f68588ff36b27360efd Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 2 Jan 2024 21:39:08 +0100 Subject: [PATCH 12/20] review: restore linter settings order --- pkg/config/linters_settings.go | 4 ++-- pkg/lint/lintersdb/manager.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index 3ec004f1eed0..8166ebf9c4be 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -186,10 +186,10 @@ type LintersSettings struct { Decorder DecorderSettings Depguard DepGuardSettings Dogsled DogsledSettings - DupWord DupWordSettings Dupl DuplSettings - ErrChkJSON ErrChkJSONSettings + DupWord DupWordSettings Errcheck ErrcheckSettings + ErrChkJSON ErrChkJSONSettings ErrorLint ErrorLintSettings Exhaustive ExhaustiveSettings ExhaustiveStruct ExhaustiveStructSettings diff --git a/pkg/lint/lintersdb/manager.go b/pkg/lint/lintersdb/manager.go index 4b33a5280676..e30d48e4f10c 100644 --- a/pkg/lint/lintersdb/manager.go +++ b/pkg/lint/lintersdb/manager.go @@ -170,8 +170,6 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { funlenCfg = &m.cfg.LintersSettings.Funlen gciCfg = &m.cfg.LintersSettings.Gci ginkgolinterCfg = &m.cfg.LintersSettings.GinkgoLinter - goMndCfg = &m.cfg.LintersSettings.Gomnd - goModDirectivesCfg = &m.cfg.LintersSettings.GoModDirectives gocognitCfg = &m.cfg.LintersSettings.Gocognit goconstCfg = &m.cfg.LintersSettings.Goconst gocriticCfg = &m.cfg.LintersSettings.Gocritic @@ -183,6 +181,8 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { goheaderCfg = &m.cfg.LintersSettings.Goheader goimportsCfg = &m.cfg.LintersSettings.Goimports golintCfg = &m.cfg.LintersSettings.Golint + goMndCfg = &m.cfg.LintersSettings.Gomnd + goModDirectivesCfg = &m.cfg.LintersSettings.GoModDirectives gomodguardCfg = &m.cfg.LintersSettings.Gomodguard gosecCfg = &m.cfg.LintersSettings.Gosec gosimpleCfg = &m.cfg.LintersSettings.Gosimple From b056abaa82d20f12f19b6e0fb46ed9b6da2a8c12 Mon Sep 17 00:00:00 2001 From: Joshua Timmons Date: Tue, 2 Jan 2024 18:10:03 -0500 Subject: [PATCH 13/20] Simplify settings --- .golangci.reference.yml | 39 ++------ go.mod | 2 +- go.sum | 4 +- pkg/config/linters_settings.go | 8 +- pkg/golinters/spancheck.go | 17 ++-- test/testdata/spancheck/configs/default.yml | 1 + .../testdata/spancheck/configs/enable_all.yml | 9 +- test/testdata/spancheck/spancheck_default.go | 94 +++++++++++++++++++ .../{spancheck.go => spancheck_enable_all.go} | 0 9 files changed, 120 insertions(+), 54 deletions(-) create mode 100644 test/testdata/spancheck/configs/default.yml create mode 100644 test/testdata/spancheck/spancheck_default.go rename test/testdata/spancheck/{spancheck.go => spancheck_enable_all.go} (100%) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index dde175ca6b10..90b6e0928a19 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -1913,40 +1913,19 @@ linters-settings: args-on-sep-lines: true spancheck: - # Disable the span.End() check. - # Default: false - disable-end-check: true - - # Enable all checks. - # This overrides individual check settings. - # Default: false - enable-all: true - - # Enables a check that `span.RecordError` is called whenever a path to a return statement with an error is found. - # Developers should use `span.RecordError(err)` to create an exception event on the span. - # https://github.com/jjti/go-spancheck#checks - # Default: false - enable-record-error-check: true - - # Enables a check that `span.SetStatus` is called whenever a path to a return statement with an error is found. - # Developers should use `span.SetStatus(codes.Error, msg)` to set the `status:error` attribute on the span. - # https://github.com/jjti/go-spancheck#checks - # Default: false - enable-set-status-check: true - - # A slice of regexes for function signatures that, - # if found in the call path to an error return statement, - # should silence the RecordError check. + # Checks to enable. By default, only the "end" (`span.End()`) check is enabled. # https://github.com/jjti/go-spancheck#configuration - # Default: [] - ignore-record-error-check-signatures: - - "telemetry.RecordError" + # Default: ["end"] + checks: + - "end" + - "record-error" + - "set-status" - # A slice of regexes for function signatures that, if found in the call path to an error return statement, - # should silence the SetStatus check. + # A slice of regexes for function signatures that, if found in the call path to a returned error, + # silence "record-error" or "set-status" warnings. # https://github.com/jjti/go-spancheck#configuration # Default: [] - ignore-set-status-check-signatures: + ignore-check-signatures: - "telemetry.RecordError" staticcheck: diff --git a/go.mod b/go.mod index b130ebb53838..9cec4e844239 100644 --- a/go.mod +++ b/go.mod @@ -57,7 +57,7 @@ require ( github.com/jgautheron/goconst v1.7.0 github.com/jingyugao/rowserrcheck v1.1.1 github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af - github.com/jjti/go-spancheck v0.3.3 + github.com/jjti/go-spancheck v0.4.1 github.com/julz/importas v0.1.0 github.com/kisielk/errcheck v1.6.3 github.com/kkHAIKE/contextcheck v1.1.4 diff --git a/go.sum b/go.sum index 1520a82c6b30..b2ea7101abb8 100644 --- a/go.sum +++ b/go.sum @@ -310,8 +310,8 @@ github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjz github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= -github.com/jjti/go-spancheck v0.3.3 h1:E1a7H9DM2EBySR4iYrRiQK46pqlc2EGVmGpwg4VvH6Y= -github.com/jjti/go-spancheck v0.3.3/go.mod h1:ARPNI1JRG1V2Rjnd6/2f2NEfghjSVDZGVmruNKlnXU0= +github.com/jjti/go-spancheck v0.4.1 h1:NP1p0b9wHpGdV9ciCBQLGaEfZtjVQ/lyjt0LOud/VEg= +github.com/jjti/go-spancheck v0.4.1/go.mod h1:ARPNI1JRG1V2Rjnd6/2f2NEfghjSVDZGVmruNKlnXU0= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index 8166ebf9c4be..fd7c5f80e796 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -775,12 +775,8 @@ type SlogLintSettings struct { } type SpancheckSettings struct { - DisableEndCheck bool `mapstructure:"disable-end-check"` - EnableAll bool `mapstructure:"enable-all"` - EnableRecordErrorCheck bool `mapstructure:"enable-record-error-check"` - EnableSetStatusCheck bool `mapstructure:"enable-set-status-check"` - IgnoreRecordErrorCheckSignatures []string `mapstructure:"ignore-record-error-check-signatures"` - IgnoreSetStatusCheckSignatures []string `mapstructure:"ignore-set-status-check-signatures"` + Checks []string `mapstructure:"checks"` + IgnoreCheckSignatures []string `mapstructure:"ignore-check-signatures"` } type StaticCheckSettings struct { diff --git a/pkg/golinters/spancheck.go b/pkg/golinters/spancheck.go index 377635b29639..0e7e0b3ba125 100644 --- a/pkg/golinters/spancheck.go +++ b/pkg/golinters/spancheck.go @@ -9,20 +9,15 @@ import ( ) func NewSpancheck(settings *config.SpancheckSettings) *goanalysis.Linter { - cfg := &spancheck.Config{} - if settings != nil { - cfg = &spancheck.Config{ - DisableEndCheck: settings.DisableEndCheck, - EnableAll: settings.EnableAll, - EnableRecordErrorCheck: settings.EnableRecordErrorCheck, - EnableSetStatusCheck: settings.EnableSetStatusCheck, - IgnoreRecordErrorCheckSignaturesSlice: settings.IgnoreRecordErrorCheckSignatures, - IgnoreSetStatusCheckSignaturesSlice: settings.IgnoreSetStatusCheckSignatures, - } + cfg := spancheck.NewDefaultConfig() + if settings != nil && settings.Checks != nil { + cfg.EnabledChecks = settings.Checks + } + if settings != nil && settings.IgnoreCheckSignatures != nil { + cfg.IgnoreChecksSignaturesSlice = settings.IgnoreCheckSignatures } a := spancheck.NewAnalyzerWithConfig(cfg) - return goanalysis. NewLinter(a.Name, a.Doc, []*analysis.Analyzer{a}, nil). WithLoadMode(goanalysis.LoadModeTypesInfo) diff --git a/test/testdata/spancheck/configs/default.yml b/test/testdata/spancheck/configs/default.yml new file mode 100644 index 000000000000..28539959c36f --- /dev/null +++ b/test/testdata/spancheck/configs/default.yml @@ -0,0 +1 @@ +linters-settings: diff --git a/test/testdata/spancheck/configs/enable_all.yml b/test/testdata/spancheck/configs/enable_all.yml index c84fecba42b6..1ea3518098bb 100644 --- a/test/testdata/spancheck/configs/enable_all.yml +++ b/test/testdata/spancheck/configs/enable_all.yml @@ -1,7 +1,8 @@ linters-settings: spancheck: - enable-all: true - ignore-record-error-check-signatures: - - "recordErr" - ignore-set-status-check-signatures: + checks: + - "end" + - "record-error" + - "set-status" + ignore-check-signatures: - "recordErr" diff --git a/test/testdata/spancheck/spancheck_default.go b/test/testdata/spancheck/spancheck_default.go new file mode 100644 index 000000000000..f6b7750c6bb2 --- /dev/null +++ b/test/testdata/spancheck/spancheck_default.go @@ -0,0 +1,94 @@ +//golangcitest:config_path configs/default.yml +//golangcitest:args --disable-all -Espancheck +package spancheck + +import ( + "context" + "errors" + "fmt" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" +) + +type testError struct{} + +func (e *testError) Error() string { + return "foo" +} + +// incorrect + +func _() { + otel.Tracer("foo").Start(context.Background(), "bar") // want "span is unassigned, probable memory leak" + ctx, _ := otel.Tracer("foo").Start(context.Background(), "bar") // want "span is unassigned, probable memory leak" + fmt.Print(ctx) +} + +func _() { + ctx, span := otel.Tracer("foo").Start(context.Background(), "bar") // want "span.End is not called on all paths, possible memory leak" + print(ctx.Done(), span.IsRecording()) +} // want "return can be reached without calling span.End" + +func _() { + var ctx, span = otel.Tracer("foo").Start(context.Background(), "bar") // want "span.End is not called on all paths, possible memory leak" + print(ctx.Done(), span.IsRecording()) +} // want "return can be reached without calling span.End" + +func _() { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") // want "span.End is not called on all paths, possible memory leak" + _, span = otel.Tracer("foo").Start(context.Background(), "bar") + fmt.Print(span) + defer span.End() +} // want "return can be reached without calling span.End" + +// correct + +func _() error { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") + defer span.End() + + return nil +} + +func _() error { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") + defer span.End() + + if true { + return nil + } + + return nil +} + +func _() error { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") + defer span.End() + + if false { + err := errors.New("foo") + span.SetStatus(codes.Error, err.Error()) + span.RecordError(err) + return err + } + + if true { + span.SetStatus(codes.Error, "foo") + span.RecordError(errors.New("foo")) + return errors.New("bar") + } + + return nil +} + +func _() { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") + defer span.End() + + _, span = otel.Tracer("foo").Start(context.Background(), "bar") + defer span.End() +} + +func recordErr(span trace.Span, err error) {} diff --git a/test/testdata/spancheck/spancheck.go b/test/testdata/spancheck/spancheck_enable_all.go similarity index 100% rename from test/testdata/spancheck/spancheck.go rename to test/testdata/spancheck/spancheck_enable_all.go From 5af78ab71f410028498f23e1a512cbc9d32d50e9 Mon Sep 17 00:00:00 2001 From: Joshua Timmons Date: Tue, 2 Jan 2024 18:14:17 -0500 Subject: [PATCH 14/20] Expand comment --- .golangci.reference.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 90b6e0928a19..200550e0d45f 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -1913,7 +1913,11 @@ linters-settings: args-on-sep-lines: true spancheck: - # Checks to enable. By default, only the "end" (`span.End()`) check is enabled. + # Checks to enable. By default, only the "end" check is enabled. + # Options include: + # - "end": check that `span.End()` is called + # - "record-error": check that `span.RecordError(err)` is called when an error is returned + # - "set-status": check that `span.SetStatus(codes.Error, msg)` is called when an error is returned # https://github.com/jjti/go-spancheck#configuration # Default: ["end"] checks: From bbf6343dbaf53b46408d1423942728e14710dee3 Mon Sep 17 00:00:00 2001 From: Joshua Timmons Date: Tue, 2 Jan 2024 18:22:25 -0500 Subject: [PATCH 15/20] Remove -disable-all flag --- test/testdata/spancheck/spancheck_default.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testdata/spancheck/spancheck_default.go b/test/testdata/spancheck/spancheck_default.go index f6b7750c6bb2..26d1c46b69ad 100644 --- a/test/testdata/spancheck/spancheck_default.go +++ b/test/testdata/spancheck/spancheck_default.go @@ -1,5 +1,5 @@ //golangcitest:config_path configs/default.yml -//golangcitest:args --disable-all -Espancheck +//golangcitest:args -Espancheck package spancheck import ( From 5ee213fc7c5fee3c8c9ba0db7f595b06ee638e67 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Wed, 3 Jan 2024 03:32:06 +0100 Subject: [PATCH 16/20] review: clean --- pkg/golinters/spancheck.go | 15 ++++++++++----- test/testdata/spancheck/configs/default.yml | 1 - test/testdata/spancheck/spancheck_default.go | 8 ++------ test/testdata/spancheck/spancheck_enable_all.go | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 test/testdata/spancheck/configs/default.yml diff --git a/pkg/golinters/spancheck.go b/pkg/golinters/spancheck.go index 0e7e0b3ba125..934124477767 100644 --- a/pkg/golinters/spancheck.go +++ b/pkg/golinters/spancheck.go @@ -10,14 +10,19 @@ import ( func NewSpancheck(settings *config.SpancheckSettings) *goanalysis.Linter { cfg := spancheck.NewDefaultConfig() - if settings != nil && settings.Checks != nil { - cfg.EnabledChecks = settings.Checks - } - if settings != nil && settings.IgnoreCheckSignatures != nil { - cfg.IgnoreChecksSignaturesSlice = settings.IgnoreCheckSignatures + + if settings != nil { + if settings.Checks != nil { + cfg.EnabledChecks = settings.Checks + } + + if settings.IgnoreCheckSignatures != nil { + cfg.IgnoreChecksSignaturesSlice = settings.IgnoreCheckSignatures + } } a := spancheck.NewAnalyzerWithConfig(cfg) + return goanalysis. NewLinter(a.Name, a.Doc, []*analysis.Analyzer{a}, nil). WithLoadMode(goanalysis.LoadModeTypesInfo) diff --git a/test/testdata/spancheck/configs/default.yml b/test/testdata/spancheck/configs/default.yml deleted file mode 100644 index 28539959c36f..000000000000 --- a/test/testdata/spancheck/configs/default.yml +++ /dev/null @@ -1 +0,0 @@ -linters-settings: diff --git a/test/testdata/spancheck/spancheck_default.go b/test/testdata/spancheck/spancheck_default.go index 26d1c46b69ad..e1fff76da927 100644 --- a/test/testdata/spancheck/spancheck_default.go +++ b/test/testdata/spancheck/spancheck_default.go @@ -1,4 +1,3 @@ -//golangcitest:config_path configs/default.yml //golangcitest:args -Espancheck package spancheck @@ -9,12 +8,11 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/trace" ) -type testError struct{} +type testDefaultError struct{} -func (e *testError) Error() string { +func (e *testDefaultError) Error() string { return "foo" } @@ -90,5 +88,3 @@ func _() { _, span = otel.Tracer("foo").Start(context.Background(), "bar") defer span.End() } - -func recordErr(span trace.Span, err error) {} diff --git a/test/testdata/spancheck/spancheck_enable_all.go b/test/testdata/spancheck/spancheck_enable_all.go index f824add32b26..382e714043e4 100644 --- a/test/testdata/spancheck/spancheck_enable_all.go +++ b/test/testdata/spancheck/spancheck_enable_all.go @@ -199,8 +199,8 @@ func _() error { defer span.End() err := errors.New("foo") - recordErr(span, err) + recordError(span, err) return err } -func recordErr(span trace.Span, err error) {} +func recordError(span trace.Span, err error) {} From d24463c88e65e0f1eca627454dd6f00377e6341a Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Wed, 3 Jan 2024 03:37:59 +0100 Subject: [PATCH 17/20] review: Semantic Line Breaks --- .golangci.reference.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 200550e0d45f..abdeb89f55bb 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -1913,21 +1913,19 @@ linters-settings: args-on-sep-lines: true spancheck: - # Checks to enable. By default, only the "end" check is enabled. + # Checks to enable. # Options include: - # - "end": check that `span.End()` is called - # - "record-error": check that `span.RecordError(err)` is called when an error is returned - # - "set-status": check that `span.SetStatus(codes.Error, msg)` is called when an error is returned - # https://github.com/jjti/go-spancheck#configuration + # - `end`: check that `span.End()` is called + # - `record-error`: check that `span.RecordError(err)` is called when an error is returned + # - `set-status`: check that `span.SetStatus(codes.Error, msg)` is called when an error is returned # Default: ["end"] checks: - "end" - "record-error" - "set-status" - - # A slice of regexes for function signatures that, if found in the call path to a returned error, - # silence "record-error" or "set-status" warnings. - # https://github.com/jjti/go-spancheck#configuration + # A slice of regexes for function signatures that, + # if found in the call path to a returned error, + # silence `record-error` or `set-status` reports. # Default: [] ignore-check-signatures: - "telemetry.RecordError" From 18ccd3d2b32f3bdf164340b1e23e717990d4112f Mon Sep 17 00:00:00 2001 From: Joshua Timmons Date: Tue, 2 Jan 2024 21:39:31 -0500 Subject: [PATCH 18/20] Reformat comment and example a bit --- .golangci.reference.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index abdeb89f55bb..919a7c5a4ad1 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -1920,12 +1920,13 @@ linters-settings: # - `set-status`: check that `span.SetStatus(codes.Error, msg)` is called when an error is returned # Default: ["end"] checks: - - "end" - - "record-error" - - "set-status" - # A slice of regexes for function signatures that, + - end + - record-error + - set-status + + # A list of regexes for function signatures that silence "record-error" or "set-status" warnings # if found in the call path to a returned error, - # silence `record-error` or `set-status` reports. + # https://github.com/jjti/go-spancheck#configuration # Default: [] ignore-check-signatures: - "telemetry.RecordError" From c8e7a87bae2b58e3ff76112cc42c5a3f51ef5e74 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Wed, 3 Jan 2024 03:54:53 +0100 Subject: [PATCH 19/20] review: use the analysis vocalubary, fix link, be homogenoous with other sections --- .golangci.reference.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 919a7c5a4ad1..c21108ba81e8 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -1923,10 +1923,9 @@ linters-settings: - end - record-error - set-status - - # A list of regexes for function signatures that silence "record-error" or "set-status" warnings - # if found in the call path to a returned error, - # https://github.com/jjti/go-spancheck#configuration + # A list of regexes for function signatures that silence `record-error` and `set-status` reports + # if found in the call path to a returned error. + # https://github.com/jjti/go-spancheck#ignore-check-signatures # Default: [] ignore-check-signatures: - "telemetry.RecordError" From 60f880bc6c3705680ccc72278d052cd09b136674 Mon Sep 17 00:00:00 2001 From: Joshua Timmons Date: Tue, 2 Jan 2024 22:12:27 -0500 Subject: [PATCH 20/20] Bump to version w/o slices --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 9cec4e844239..92a81fb903b4 100644 --- a/go.mod +++ b/go.mod @@ -57,7 +57,7 @@ require ( github.com/jgautheron/goconst v1.7.0 github.com/jingyugao/rowserrcheck v1.1.1 github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af - github.com/jjti/go-spancheck v0.4.1 + github.com/jjti/go-spancheck v0.4.2 github.com/julz/importas v0.1.0 github.com/kisielk/errcheck v1.6.3 github.com/kkHAIKE/contextcheck v1.1.4 diff --git a/go.sum b/go.sum index b2ea7101abb8..0b979a22d37e 100644 --- a/go.sum +++ b/go.sum @@ -310,8 +310,8 @@ github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjz github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= -github.com/jjti/go-spancheck v0.4.1 h1:NP1p0b9wHpGdV9ciCBQLGaEfZtjVQ/lyjt0LOud/VEg= -github.com/jjti/go-spancheck v0.4.1/go.mod h1:ARPNI1JRG1V2Rjnd6/2f2NEfghjSVDZGVmruNKlnXU0= +github.com/jjti/go-spancheck v0.4.2 h1:4MvJOTKRi9ClsPNTxVhHvcSyuInILLSKmstTCJ/oIZI= +github.com/jjti/go-spancheck v0.4.2/go.mod h1:TBZ1nIcHTtCnBChHcjd+5agCxHBaW0tzw9quzCCNAts= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=