From 2170a12aa477055a52c1fbf9eb6dc44e586f6b76 Mon Sep 17 00:00:00 2001 From: 180909 <734461790@qq.com> Date: Sat, 24 Sep 2022 23:29:00 +0800 Subject: [PATCH] fix: modify interface check way on selector (#2399) --- selector/default_node.go | 2 ++ selector/default_selector.go | 5 +++++ selector/node/direct/direct.go | 4 ++-- selector/node/ewma/node.go | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/selector/default_node.go b/selector/default_node.go index 186629e78..3554a3a13 100644 --- a/selector/default_node.go +++ b/selector/default_node.go @@ -6,6 +6,8 @@ import ( "github.com/go-kratos/kratos/v2/registry" ) +var _ Node = (*DefaultNode)(nil) + // DefaultNode is selector node type DefaultNode struct { scheme string diff --git a/selector/default_selector.go b/selector/default_selector.go index 247af2e92..83b1ce9e6 100644 --- a/selector/default_selector.go +++ b/selector/default_selector.go @@ -5,6 +5,11 @@ import ( "sync/atomic" ) +var ( + _ Rebalancer = (*Default)(nil) + _ Builder = (*DefaultBuilder)(nil) +) + // Default is composite selector. type Default struct { NodeBuilder WeightedNodeBuilder diff --git a/selector/node/direct/direct.go b/selector/node/direct/direct.go index 62b30ed7f..d32fc3148 100644 --- a/selector/node/direct/direct.go +++ b/selector/node/direct/direct.go @@ -13,8 +13,8 @@ const ( ) var ( - _ selector.WeightedNode = &Node{} - _ selector.WeightedNodeBuilder = &Builder{} + _ selector.WeightedNode = (*Node)(nil) + _ selector.WeightedNodeBuilder = (*Builder)(nil) ) // Node is endpoint instance diff --git a/selector/node/ewma/node.go b/selector/node/ewma/node.go index 1707f1083..4fed4aaa2 100644 --- a/selector/node/ewma/node.go +++ b/selector/node/ewma/node.go @@ -21,8 +21,8 @@ const ( ) var ( - _ selector.WeightedNode = &Node{} - _ selector.WeightedNodeBuilder = &Builder{} + _ selector.WeightedNode = (*Node)(nil) + _ selector.WeightedNodeBuilder = (*Builder)(nil) ) // Node is endpoint instance