Skip to content

Commit

Permalink
fix(contrib/polaris): incorrect conversion between integer types (#3300)
Browse files Browse the repository at this point in the history
* fix(contrib/polaris): convert string to int32

* fix
  • Loading branch information
demoManito authored Apr 27, 2024
1 parent b3b2a34 commit 45603e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contrib/polaris/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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())),
Expand Down

0 comments on commit 45603e3

Please sign in to comment.