Update metrics/registry.go

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
This commit is contained in:
Ömer Faruk Irmak 2025-06-05 00:01:24 +03:00 committed by GitHub
parent 04845621bc
commit d6af162a15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -328,7 +328,7 @@ func Get(name string) interface{} {
// GetOrRegister gets an existing metric or creates and registers a new one. Threadsafe // GetOrRegister gets an existing metric or creates and registers a new one. Threadsafe
// alternative to calling Get and Register on failure. // alternative to calling Get and Register on failure.
func GetOrRegister[T any](name string, ctor func() T, r Registry) interface{} { func GetOrRegister[T any](name string, ctor func() T, r Registry) interface{} {
if nil == r { if r == nil {
r = DefaultRegistry r = DefaultRegistry
} }
return r.GetOrRegister(name, func() any { return ctor() }) return r.GetOrRegister(name, func() any { return ctor() })