Fix gopls modernize warnings

Signed-off-by: Philip Laine <philip.laine@gmail.com>
This commit is contained in:
Philip Laine 2025-04-15 11:18:41 +02:00
parent fa5c3bd1c1
commit e52e1c4682
No known key found for this signature in database
GPG Key ID: F6D0B743CA3EFF33
4 changed files with 6 additions and 9 deletions

View File

@ -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

View File

@ -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
},

View File

@ -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
}

View File

@ -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)
}