Skip to content

Commit

Permalink
Replace interface{} with any alias (#778)
Browse files Browse the repository at this point in the history
  • Loading branch information
phillebaba authored Mar 7, 2025
2 parents 435da8e + 88f2eb7 commit 7ea98b1
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion internal/buffer/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/oci/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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],
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/oci/containerd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func TestGetEventImage(t *testing.T) {

tests := []struct {
name string
data interface{}
data any
expectedErr string
expectedName string
expectedEventType EventType
Expand Down
2 changes: 1 addition & 1 deletion pkg/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions pkg/routing/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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),
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7ea98b1

Please sign in to comment.