chore: gofmt -w -r 'interface{} -> any' . (#2790)
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
This commit is contained in:
parent
b71cbc94cf
commit
d189e18026
|
|
@ -324,7 +324,7 @@ type DownloadOption struct {
|
|||
CacheRecursiveMetadata time.Duration `mapstructure:"cacheRecursiveMetadata" yaml:"cacheRecursiveMetadata"`
|
||||
}
|
||||
|
||||
type ResourceClientsOption map[string]interface{}
|
||||
type ResourceClientsOption map[string]any
|
||||
|
||||
type TransportOption struct {
|
||||
DialTimeout time.Duration `mapstructure:"dialTimeout" yaml:"dialTimeout"`
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ func loadSourceClients(cmd *cobra.Command) error {
|
|||
if !os.IsNotExist(err) {
|
||||
logger.Warnf("load daemon config err: %s, use default config", err)
|
||||
}
|
||||
if err = source.InitSourceClients(map[string]interface{}{}); err != nil {
|
||||
if err = source.InitSourceClients(map[string]any{}); err != nil {
|
||||
logger.Errorf("init source clients with default config err: %s", err)
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,9 +67,9 @@ type Refresher interface {
|
|||
Refresh() error
|
||||
}
|
||||
|
||||
// UnaryClientInterceptor returns a new unary client interceptor that refresh dynconfig addresses when calling error.
|
||||
// RefresherUnaryClientInterceptor returns a new unary client interceptor that refresh dynconfig addresses when calling error.
|
||||
func RefresherUnaryClientInterceptor(r Refresher) grpc.UnaryClientInterceptor {
|
||||
return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
|
||||
return func(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
|
||||
err := invoker(ctx, method, req, reply, cc, opts...)
|
||||
if s, ok := status.FromError(err); ok {
|
||||
if s.Code() == codes.ResourceExhausted || s.Code() == codes.Unavailable {
|
||||
|
|
@ -82,7 +82,7 @@ func RefresherUnaryClientInterceptor(r Refresher) grpc.UnaryClientInterceptor {
|
|||
}
|
||||
}
|
||||
|
||||
// StreamClientInterceptor returns a new stream client interceptor that refresh dynconfig addresses when calling error.
|
||||
// RefresherStreamClientInterceptor returns a new stream client interceptor that refresh dynconfig addresses when calling error.
|
||||
func RefresherStreamClientInterceptor(r Refresher) grpc.StreamClientInterceptor {
|
||||
return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {
|
||||
clientStream, err := streamer(ctx, desc, cc, method, opts...)
|
||||
|
|
|
|||
|
|
@ -210,14 +210,14 @@ func fetchAuthInfo(host string, skipCheckExist bool) (string, error) {
|
|||
return "", err
|
||||
}
|
||||
|
||||
var jsonData map[string]interface{}
|
||||
var jsonData map[string]any
|
||||
if err = json.Unmarshal(databytes, &jsonData); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
for _, v := range jsonData {
|
||||
for registry, v1 := range (v).(map[string]interface{}) {
|
||||
for _, credentials := range (v1).(map[string]interface{}) {
|
||||
for registry, v1 := range (v).(map[string]any) {
|
||||
for _, credentials := range (v1).(map[string]any) {
|
||||
if registry == host {
|
||||
auth = credentials.(string)
|
||||
}
|
||||
|
|
@ -268,7 +268,7 @@ func (client *orasSourceClient) fetchTokenWithHeader(ctx context.Context, authHe
|
|||
}
|
||||
defer response.Body.Close()
|
||||
|
||||
var tokenData map[string]interface{}
|
||||
var tokenData map[string]any
|
||||
if err = json.Unmarshal(token, &tokenData); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import (
|
|||
|
||||
var (
|
||||
resourceClientBuilder = map[string]ResourceClientBuilder{}
|
||||
resourceClientOptions = map[string]interface{}{}
|
||||
resourceClientOptions = map[string]any{}
|
||||
resourceDirector = map[string]Director{}
|
||||
)
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ func UnRegisterBuilder(scheme string) {
|
|||
}
|
||||
|
||||
// InitSourceClients will initialize all resource clients which registered by RegisterBuilder.
|
||||
func InitSourceClients(opts map[string]interface{}) error {
|
||||
func InitSourceClients(opts map[string]any) error {
|
||||
// save options for resource plugin
|
||||
resourceClientOptions = opts
|
||||
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ func TestNetworkTopology_FindProbedHosts(t *testing.T) {
|
|||
probedCountKeys = append(probedCountKeys, pkgredis.MakeProbedCountKeyInScheduler(host.ID))
|
||||
}
|
||||
|
||||
mockRDBClient.ExpectMGet(probedCountKeys...).SetVal([]interface{}{"6", "5", "4", "3", "2", "1"})
|
||||
mockRDBClient.ExpectMGet(probedCountKeys...).SetVal([]any{"6", "5", "4", "3", "2", "1"})
|
||||
},
|
||||
expect: func(t *testing.T, networkTopology NetworkTopology, err error, hosts []*resource.Host) {
|
||||
assert := assert.New(t)
|
||||
|
|
@ -342,7 +342,7 @@ func TestNetworkTopology_FindProbedHosts(t *testing.T) {
|
|||
probedCountKeys = append(probedCountKeys, pkgredis.MakeProbedCountKeyInScheduler(host.ID))
|
||||
}
|
||||
|
||||
mockRDBClient.ExpectMGet(probedCountKeys...).SetVal([]interface{}{"1"})
|
||||
mockRDBClient.ExpectMGet(probedCountKeys...).SetVal([]any{"1"})
|
||||
},
|
||||
expect: func(t *testing.T, networkTopology NetworkTopology, err error, hosts []*resource.Host) {
|
||||
assert := assert.New(t)
|
||||
|
|
@ -426,7 +426,7 @@ func TestNetworkTopology_FindProbedHosts(t *testing.T) {
|
|||
probedCountKeys = append(probedCountKeys, pkgredis.MakeProbedCountKeyInScheduler(host.ID))
|
||||
}
|
||||
|
||||
mockRDBClient.ExpectMGet(probedCountKeys...).SetVal([]interface{}{"foo", "5", "4", "3", "2", "1"})
|
||||
mockRDBClient.ExpectMGet(probedCountKeys...).SetVal([]any{"foo", "5", "4", "3", "2", "1"})
|
||||
},
|
||||
expect: func(t *testing.T, networkTopology NetworkTopology, err error, hosts []*resource.Host) {
|
||||
assert := assert.New(t)
|
||||
|
|
@ -456,7 +456,7 @@ func TestNetworkTopology_FindProbedHosts(t *testing.T) {
|
|||
probedCountKeys = append(probedCountKeys, pkgredis.MakeProbedCountKeyInScheduler(host.ID))
|
||||
}
|
||||
|
||||
mockRDBClient.ExpectMGet(probedCountKeys...).SetVal([]interface{}{6, "5", "4", "3", "2", "1"})
|
||||
mockRDBClient.ExpectMGet(probedCountKeys...).SetVal([]any{6, "5", "4", "3", "2", "1"})
|
||||
},
|
||||
expect: func(t *testing.T, networkTopology NetworkTopology, err error, hosts []*resource.Host) {
|
||||
assert := assert.New(t)
|
||||
|
|
@ -486,7 +486,7 @@ func TestNetworkTopology_FindProbedHosts(t *testing.T) {
|
|||
probedCountKeys = append(probedCountKeys, pkgredis.MakeProbedCountKeyInScheduler(host.ID))
|
||||
}
|
||||
|
||||
mockRDBClient.ExpectMGet(probedCountKeys...).SetVal([]interface{}{nil, "5", "4", "3", "2", "1"})
|
||||
mockRDBClient.ExpectMGet(probedCountKeys...).SetVal([]any{nil, "5", "4", "3", "2", "1"})
|
||||
mockRDBClient.ExpectSet(probedCountKeys[0], 0, 0).SetVal("ok")
|
||||
},
|
||||
expect: func(t *testing.T, networkTopology NetworkTopology, err error, hosts []*resource.Host) {
|
||||
|
|
@ -523,7 +523,7 @@ func TestNetworkTopology_FindProbedHosts(t *testing.T) {
|
|||
probedCountKeys = append(probedCountKeys, pkgredis.MakeProbedCountKeyInScheduler(host.ID))
|
||||
}
|
||||
|
||||
mockRDBClient.ExpectMGet(probedCountKeys...).SetVal([]interface{}{nil, "5", "4", "3", "2", "1"})
|
||||
mockRDBClient.ExpectMGet(probedCountKeys...).SetVal([]any{nil, "5", "4", "3", "2", "1"})
|
||||
mockRDBClient.ExpectSet(probedCountKeys[0], 0, 0).SetErr(errors.New("Initialize the probedCount value of host in redis error"))
|
||||
},
|
||||
expect: func(t *testing.T, networkTopology NetworkTopology, err error, hosts []*resource.Host) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue