diff --git a/CHANGELOG.md b/CHANGELOG.md index acf63d72..afd1dd8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#750](https://github.com/spegel-org/spegel/pull/750) Rename append mirrors to prepend existing. - [#373](https://github.com/spegel-org/spegel/pull/373) Apply mirror configuration on all registires by default. - [#762](https://github.com/spegel-org/spegel/pull/762) Set appropriate buckets for response size +- [#778](https://github.com/spegel-org/spegel/pull/778) Replace interface{} with any alias. ### Deprecated diff --git a/internal/buffer/buffer.go b/internal/buffer/buffer.go index 33f8738e..9f33253f 100644 --- a/internal/buffer/buffer.go +++ b/internal/buffer/buffer.go @@ -9,7 +9,7 @@ type BufferPool struct { func NewBufferPool() *BufferPool { return &BufferPool{ pool: sync.Pool{ - New: func() interface{} { + New: func() any { return make([]byte, 32*1024) }, }, diff --git a/pkg/oci/containerd.go b/pkg/oci/containerd.go index 35bdced9..c985429d 100644 --- a/pkg/oci/containerd.go +++ b/pkg/oci/containerd.go @@ -524,7 +524,7 @@ Authorization = '{{ $authorization }}' } type hostFile struct { - Hosts map[string]interface{} `toml:"host"` + Hosts map[string]any `toml:"host"` } func existingHosts(fs afero.Fs, configPath string, mirroredRegistry url.URL) (string, error) { @@ -567,7 +567,7 @@ func existingHosts(fs afero.Fs, configPath string, mirroredRegistry url.URL) (st ehs := []string{} for _, h := range hosts { data := hostFile{ - Hosts: map[string]interface{}{ + Hosts: map[string]any{ h: hf.Hosts[h], }, } diff --git a/pkg/oci/containerd_test.go b/pkg/oci/containerd_test.go index 32ca1466..f94d2b89 100644 --- a/pkg/oci/containerd_test.go +++ b/pkg/oci/containerd_test.go @@ -208,7 +208,7 @@ func TestGetEventImage(t *testing.T) { tests := []struct { name string - data interface{} + data any expectedErr string expectedName string expectedEventType EventType diff --git a/pkg/registry/registry.go b/pkg/registry/registry.go index dfb2a383..5996ab20 100644 --- a/pkg/registry/registry.go +++ b/pkg/registry/registry.go @@ -138,7 +138,7 @@ func (r *Registry) handle(rw mux.ResponseWriter, req *http.Request) { return } - kvs := []interface{}{ + kvs := []any{ "path", req.URL.Path, "status", rw.Status(), "method", req.Method, diff --git a/pkg/routing/bootstrap.go b/pkg/routing/bootstrap.go index e84c6e98..f11fec76 100644 --- a/pkg/routing/bootstrap.go +++ b/pkg/routing/bootstrap.go @@ -63,7 +63,7 @@ var _ Bootstrapper = &KubernetesBootstrapper{} type KubernetesBootstrapper struct { cs kubernetes.Interface - initCh chan interface{} + initCh chan any leaderElectionNamespace string leaderElectioName string id string @@ -75,7 +75,7 @@ func NewKubernetesBootstrapper(cs kubernetes.Interface, namespace, name string) leaderElectionNamespace: namespace, leaderElectioName: name, cs: cs, - initCh: make(chan interface{}), + initCh: make(chan any), } } diff --git a/pkg/state/state.go b/pkg/state/state.go index 77e8ce06..87136923 100644 --- a/pkg/state/state.go +++ b/pkg/state/state.go @@ -67,7 +67,7 @@ func all(ctx context.Context, ociClient oci.Client, router routing.Router, resol metrics.AdvertisedImageTags.Reset() metrics.AdvertisedImageDigests.Reset() errs := []error{} - targets := map[string]interface{}{} + targets := map[string]any{} for _, img := range imgs { _, skipDigests := targets[img.Digest.String()] // Handle the list re-sync as update events; this will also prevent the