Skip to content

Commit 0e73168

Browse files
committed
golangci-lint: revive: enable use-any
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 9c0c49a commit 0e73168

60 files changed

Lines changed: 572 additions & 568 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ linters-settings:
6969
- name: empty-lines
7070
severity: warning
7171
disabled: false
72+
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#use-any
73+
- name: use-any
74+
severity: warning
75+
disabled: false
7276

7377
issues:
7478
# The default exclusion rules are a bit too permissive, so copying the relevant ones below

cli-plugins/manager/error.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ func wrapAsPluginError(err error, msg string) error {
4343

4444
// NewPluginError creates a new pluginError, analogous to
4545
// errors.Errorf.
46-
func NewPluginError(msg string, args ...interface{}) error {
46+
func NewPluginError(msg string, args ...any) error {
4747
return &pluginError{cause: errors.Errorf(msg, args...)}
4848
}

cli/command/cli.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ func UserAgent() string {
514514
}
515515

516516
var defaultStoreEndpoints = []store.NamedTypeGetter{
517-
store.EndpointTypeGetter(docker.DockerEndpoint, func() interface{} { return &docker.EndpointMeta{} }),
517+
store.EndpointTypeGetter(docker.DockerEndpoint, func() any { return &docker.EndpointMeta{} }),
518518
}
519519

520520
// RegisterDefaultStoreEndpoints registers a new named endpoint
@@ -528,7 +528,7 @@ func RegisterDefaultStoreEndpoints(ep ...store.NamedTypeGetter) {
528528
// DefaultContextStoreConfig returns a new store.Config with the default set of endpoints configured.
529529
func DefaultContextStoreConfig() store.Config {
530530
return store.NewConfig(
531-
func() interface{} { return &DockerContext{} },
531+
func() any { return &DockerContext{} },
532532
defaultStoreEndpoints...,
533533
)
534534
}

cli/command/config/inspect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func RunConfigInspect(dockerCli command.Cli, opts InspectOptions) error {
4848
opts.Format = "pretty"
4949
}
5050

51-
getRef := func(id string) (interface{}, []byte, error) {
51+
getRef := func(id string) (any, []byte, error) {
5252
return client.ConfigInspectWithRaw(ctx, id)
5353
}
5454
f := opts.Format

cli/command/container/inspect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func runInspect(dockerCli command.Cli, opts inspectOptions) error {
4343
client := dockerCli.Client()
4444
ctx := context.Background()
4545

46-
getRefFunc := func(ref string) (interface{}, []byte, error) {
46+
getRefFunc := func(ref string) (any, []byte, error) {
4747
return client.ContainerInspectWithRaw(ctx, ref, opts.size)
4848
}
4949
return inspect.Inspect(dockerCli.Out(), opts.refs, opts.format, getRefFunc)

cli/command/context.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import (
1010
// DockerContext is a typed representation of what we put in Context metadata
1111
type DockerContext struct {
1212
Description string
13-
AdditionalFields map[string]interface{}
13+
AdditionalFields map[string]any
1414
}
1515

1616
// MarshalJSON implements custom JSON marshalling
1717
func (dc DockerContext) MarshalJSON() ([]byte, error) {
18-
s := map[string]interface{}{}
18+
s := map[string]any{}
1919
if dc.Description != "" {
2020
s["Description"] = dc.Description
2121
}
@@ -29,7 +29,7 @@ func (dc DockerContext) MarshalJSON() ([]byte, error) {
2929

3030
// UnmarshalJSON implements custom JSON marshalling
3131
func (dc *DockerContext) UnmarshalJSON(payload []byte) error {
32-
var data map[string]interface{}
32+
var data map[string]any
3333
if err := json.Unmarshal(payload, &data); err != nil {
3434
return err
3535
}
@@ -39,7 +39,7 @@ func (dc *DockerContext) UnmarshalJSON(payload []byte) error {
3939
dc.Description = v.(string)
4040
default:
4141
if dc.AdditionalFields == nil {
42-
dc.AdditionalFields = make(map[string]interface{})
42+
dc.AdditionalFields = make(map[string]any)
4343
}
4444
dc.AdditionalFields[k] = v
4545
}

cli/command/context/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func createNewContext(contextStore store.ReaderWriter, o *CreateOptions) error {
8787
return errors.Wrap(err, "unable to create docker endpoint config")
8888
}
8989
contextMetadata := store.Metadata{
90-
Endpoints: map[string]interface{}{
90+
Endpoints: map[string]any{
9191
docker.DockerEndpoint: dockerEP,
9292
},
9393
Metadata: command.DockerContext{

cli/command/context/create_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ func makeFakeCli(t *testing.T, opts ...func(*test.FakeCli)) *test.FakeCli {
1616
t.Helper()
1717
dir := t.TempDir()
1818
storeConfig := store.NewConfig(
19-
func() interface{} { return &command.DockerContext{} },
20-
store.EndpointTypeGetter(docker.DockerEndpoint, func() interface{} { return &docker.EndpointMeta{} }),
19+
func() any { return &command.DockerContext{} },
20+
store.EndpointTypeGetter(docker.DockerEndpoint, func() any { return &docker.EndpointMeta{} }),
2121
)
2222
contextStore := &command.ContextStoreWithDefault{
2323
Store: store.New(dir, storeConfig),
2424
Resolver: func() (*command.DefaultContext, error) {
2525
return &command.DefaultContext{
2626
Meta: store.Metadata{
27-
Endpoints: map[string]interface{}{
27+
Endpoints: map[string]any{
2828
docker.DockerEndpoint: docker.EndpointMeta{
2929
Host: "unix:///var/run/docker.sock",
3030
},

cli/command/context/inspect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func newInspectCommand(dockerCli command.Cli) *cobra.Command {
4040
}
4141

4242
func runInspect(dockerCli command.Cli, opts inspectOptions) error {
43-
getRefFunc := func(ref string) (interface{}, []byte, error) {
43+
getRefFunc := func(ref string) (any, []byte, error) {
4444
c, err := dockerCli.ContextStore().GetMetadata(ref)
4545
if err != nil {
4646
return nil, nil, err

cli/command/context_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
func TestDockerContextMetadataKeepAdditionalFields(t *testing.T) {
1111
c := DockerContext{
1212
Description: "test",
13-
AdditionalFields: map[string]interface{}{
13+
AdditionalFields: map[string]any{
1414
"foo": "bar",
1515
},
1616
}

0 commit comments

Comments
 (0)