diff --git a/contrib/registry/etcd/watcher.go b/contrib/registry/etcd/watcher.go index 22e63474c..a5bf63c41 100644 --- a/contrib/registry/etcd/watcher.go +++ b/contrib/registry/etcd/watcher.go @@ -7,7 +7,7 @@ import ( clientv3 "go.etcd.io/etcd/client/v3" ) -var _ registry.Watcher = &watcher{} +var _ registry.Watcher = (*watcher)(nil) type watcher struct { key string diff --git a/contrib/registry/eureka/client.go b/contrib/registry/eureka/client.go index 35dd14729..f2b4e96f3 100644 --- a/contrib/registry/eureka/client.go +++ b/contrib/registry/eureka/client.go @@ -82,7 +82,7 @@ type DataCenterInfo struct { Class string `json:"@class"` } -var _ APIInterface = new(Client) +var _ APIInterface = (*Client)(nil) type APIInterface interface { Register(ctx context.Context, ep Endpoint) error diff --git a/contrib/registry/eureka/watcher.go b/contrib/registry/eureka/watcher.go index 468d97b24..de37d3229 100644 --- a/contrib/registry/eureka/watcher.go +++ b/contrib/registry/eureka/watcher.go @@ -6,7 +6,7 @@ import ( "github.com/go-kratos/kratos/v2/registry" ) -var _ registry.Watcher = &watcher{} +var _ registry.Watcher = (*watcher)(nil) type watcher struct { ctx context.Context diff --git a/contrib/registry/zookeeper/watcher.go b/contrib/registry/zookeeper/watcher.go index 76f502fa8..f20096754 100644 --- a/contrib/registry/zookeeper/watcher.go +++ b/contrib/registry/zookeeper/watcher.go @@ -10,7 +10,7 @@ import ( "github.com/go-zookeeper/zk" ) -var _ registry.Watcher = &watcher{} +var _ registry.Watcher = (*watcher)(nil) var ErrWatcherStopped = errors.New("watcher stopped") diff --git a/middleware/logging/logging_test.go b/middleware/logging/logging_test.go index 7242f8e04..6ad1a02c9 100644 --- a/middleware/logging/logging_test.go +++ b/middleware/logging/logging_test.go @@ -11,7 +11,7 @@ import ( "github.com/go-kratos/kratos/v2/transport" ) -var _ transport.Transporter = &Transport{} +var _ transport.Transporter = (*Transport)(nil) type Transport struct { kind transport.Kind diff --git a/middleware/selector/selector_test.go b/middleware/selector/selector_test.go index 667d2755f..f12943e43 100644 --- a/middleware/selector/selector_test.go +++ b/middleware/selector/selector_test.go @@ -10,7 +10,7 @@ import ( "github.com/go-kratos/kratos/v2/transport" ) -var _ transport.Transporter = &Transport{} +var _ transport.Transporter = (*Transport)(nil) type Transport struct { kind transport.Kind diff --git a/middleware/tracing/tracing_test.go b/middleware/tracing/tracing_test.go index 8de2ceea4..222a6accd 100644 --- a/middleware/tracing/tracing_test.go +++ b/middleware/tracing/tracing_test.go @@ -14,7 +14,7 @@ import ( "go.opentelemetry.io/otel/trace" ) -var _ transport.Transporter = &mockTransport{} +var _ transport.Transporter = (*mockTransport)(nil) type headerCarrier http.Header diff --git a/selector/p2c/p2c.go b/selector/p2c/p2c.go index 6f8d5a3fa..5e339b0c2 100644 --- a/selector/p2c/p2c.go +++ b/selector/p2c/p2c.go @@ -17,7 +17,7 @@ const ( Name = "p2c" ) -var _ selector.Balancer = &Balancer{} +var _ selector.Balancer = (*Balancer)(nil) // Option is random builder option. type Option func(o *options) diff --git a/selector/random/random.go b/selector/random/random.go index cf59534d0..3af52d416 100644 --- a/selector/random/random.go +++ b/selector/random/random.go @@ -13,7 +13,7 @@ const ( Name = "random" ) -var _ selector.Balancer = &Balancer{} // Name is balancer name +var _ selector.Balancer = (*Balancer)(nil) // Name is balancer name // Option is random builder option. type Option func(o *options) diff --git a/selector/wrr/wrr.go b/selector/wrr/wrr.go index 0b95e04fb..3d91d62e3 100644 --- a/selector/wrr/wrr.go +++ b/selector/wrr/wrr.go @@ -13,7 +13,7 @@ const ( Name = "wrr" ) -var _ selector.Balancer = &Balancer{} // Name is balancer name +var _ selector.Balancer = (*Balancer)(nil) // Name is balancer name // Option is random builder option. type Option func(o *options) diff --git a/transport/grpc/transport.go b/transport/grpc/transport.go index a11a271ae..866228d1d 100644 --- a/transport/grpc/transport.go +++ b/transport/grpc/transport.go @@ -6,7 +6,7 @@ import ( "google.golang.org/grpc/metadata" ) -var _ transport.Transporter = &Transport{} +var _ transport.Transporter = (*Transport)(nil) // Transport is a gRPC transport. type Transport struct { diff --git a/transport/http/transport.go b/transport/http/transport.go index c377b5ad9..e7f53f6db 100644 --- a/transport/http/transport.go +++ b/transport/http/transport.go @@ -7,7 +7,7 @@ import ( "github.com/go-kratos/kratos/v2/transport" ) -var _ Transporter = &Transport{} +var _ Transporter = (*Transport)(nil) // Transporter is http Transporter type Transporter interface {