From 45603e3ab9c5c880630912d2227dff413180f7e7 Mon Sep 17 00:00:00 2001 From: jessetang <1430482733@qq.com> Date: Sat, 27 Apr 2024 19:37:55 +0800 Subject: [PATCH] fix(contrib/polaris): incorrect conversion between integer types (#3300) * fix(contrib/polaris): convert string to int32 * fix --- contrib/polaris/router.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/polaris/router.go b/contrib/polaris/router.go index 958db4ab4..ab22f3128 100644 --- a/contrib/polaris/router.go +++ b/contrib/polaris/router.go @@ -114,7 +114,7 @@ func buildPolarisInstance(namespace string, nodes []selector.Node) *pb.ServiceIn if err != nil { return nil } - portInt, err := strconv.Atoi(port) + portUint64, err := strconv.ParseUint(port, 10, 32) //nolint:gomnd if err != nil { return nil } @@ -123,7 +123,7 @@ func buildPolarisInstance(namespace string, nodes []selector.Node) *pb.ServiceIn Service: wrapperspb.String(node.ServiceName()), Namespace: wrapperspb.String(namespace), Host: wrapperspb.String(host), - Port: wrapperspb.UInt32(uint32(portInt)), + Port: wrapperspb.UInt32(uint32(portUint64)), Protocol: wrapperspb.String(node.Scheme()), Version: wrapperspb.String(node.Version()), Weight: wrapperspb.UInt32(uint32(*node.InitialWeight())),