Fix gopls modernize warnings
Signed-off-by: Philip Laine <philip.laine@gmail.com>
This commit is contained in:
parent
fa5c3bd1c1
commit
e52e1c4682
@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Fixed
|
||||
|
||||
- [#824](https://github.com/spegel-org/spegel/pull/824) Fix improper image string formatting and expand tests.
|
||||
- [#825](https://github.com/spegel-org/spegel/pull/825) Fix gopls modernize warnings.
|
||||
|
||||
### Security
|
||||
|
||||
|
@ -90,7 +90,7 @@ func WithBasicAuth(username, password string) Option {
|
||||
|
||||
func NewRegistry(ociClient oci.Client, router routing.Router, opts ...Option) *Registry {
|
||||
bufferPool := &sync.Pool{
|
||||
New: func() interface{} {
|
||||
New: func() any {
|
||||
buf := make([]byte, 32*1024)
|
||||
return &buf
|
||||
},
|
||||
|
@ -99,10 +99,7 @@ func (b *DNSBootstrapper) Get(ctx context.Context) ([]peer.AddrInfo, error) {
|
||||
Addrs: []ma.Multiaddr{addr},
|
||||
})
|
||||
}
|
||||
limit := b.limit
|
||||
if len(addrInfos) < limit {
|
||||
limit = len(addrInfos)
|
||||
}
|
||||
limit := min(len(addrInfos), b.limit)
|
||||
return addrInfos[:limit], nil
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package routing
|
||||
import (
|
||||
"context"
|
||||
"net/netip"
|
||||
"slices"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@ -62,10 +63,8 @@ func (m *MemoryRouter) Add(key string, ap netip.AddrPort) {
|
||||
m.resolver[key] = []netip.AddrPort{ap}
|
||||
return
|
||||
}
|
||||
for _, h := range v {
|
||||
if h == ap {
|
||||
return
|
||||
}
|
||||
if slices.Contains(v, ap) {
|
||||
return
|
||||
}
|
||||
m.resolver[key] = append(v, ap)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user