diff options
| author | Taras Madan <tarasmadan@google.com> | 2023-12-05 15:10:03 +0100 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2023-12-06 11:31:44 +0000 |
| commit | 2ab72b4feef2c97f22f90cfbf9e45a6cfcd08bda (patch) | |
| tree | a6d19b94b6399fcc00a6cfa430885cd349dd1533 /vendor/github.com/butuzov | |
| parent | e08e8f492d31d672cc245944c185f8aadf2ee695 (diff) | |
vendor: updates
Diffstat (limited to 'vendor/github.com/butuzov')
3 files changed, 20 insertions, 6 deletions
diff --git a/vendor/github.com/butuzov/ireturn/analyzer/analyzer.go b/vendor/github.com/butuzov/ireturn/analyzer/analyzer.go index 3a0bf7402..21e5897b2 100644 --- a/vendor/github.com/butuzov/ireturn/analyzer/analyzer.go +++ b/vendor/github.com/butuzov/ireturn/analyzer/analyzer.go @@ -23,6 +23,7 @@ type validator interface { type analyzer struct { once sync.Once + mu sync.RWMutex handler validator err error @@ -83,11 +84,13 @@ func (a *analyzer) run(pass *analysis.Pass) (interface{}, error) { } seen[key] = true - a.found = append(a.found, issue.ExportDiagnostic()) + a.addDiagnostic(issue.ExportDiagnostic()) } }) // 02. Printing reports. + a.mu.RLock() + defer a.mu.RUnlock() for i := range a.found { pass.Report(a.found[i]) } @@ -95,6 +98,13 @@ func (a *analyzer) run(pass *analysis.Pass) (interface{}, error) { return nil, nil } +func (a *analyzer) addDiagnostic(d analysis.Diagnostic) { + a.mu.Lock() + defer a.mu.Unlock() + + a.found = append(a.found, d) +} + func (a *analyzer) readConfiguration(fs *flag.FlagSet) { cnf, err := config.New(fs) if err != nil { diff --git a/vendor/github.com/butuzov/ireturn/analyzer/internal/config/config.go b/vendor/github.com/butuzov/ireturn/analyzer/internal/config/config.go index e2f1aef6e..46c73170a 100644 --- a/vendor/github.com/butuzov/ireturn/analyzer/internal/config/config.go +++ b/vendor/github.com/butuzov/ireturn/analyzer/internal/config/config.go @@ -2,6 +2,7 @@ package config import ( "regexp" + "sync" "github.com/butuzov/ireturn/analyzer/internal/types" ) @@ -13,16 +14,13 @@ type defaultConfig struct { List []string // private fields (for search optimization look ups) - init bool + once sync.Once quick uint8 list []*regexp.Regexp } func (config *defaultConfig) Has(i types.IFace) bool { - if !config.init { - config.compileList() - config.init = true - } + config.once.Do(config.compileList) if config.quick&uint8(i.Type) > 0 { return true diff --git a/vendor/github.com/butuzov/ireturn/analyzer/std.go b/vendor/github.com/butuzov/ireturn/analyzer/std.go index ec361cd44..4c6c4e420 100644 --- a/vendor/github.com/butuzov/ireturn/analyzer/std.go +++ b/vendor/github.com/butuzov/ireturn/analyzer/std.go @@ -191,4 +191,10 @@ var std = map[string]struct{}{ // added in Go v1.20 in compare to v1.19 (docker image) "crypto/ecdh": {}, "runtime/coverage": {}, + // added in Go v1.21 in compare to v1.20 (docker image) + "cmp": {}, + "log/slog": {}, + "maps": {}, + "slices": {}, + "testing/slogtest": {}, } |
