mirror of
https://github.com/go-kratos/kratos.git
synced 2024-12-26 20:54:38 +02:00
fix(contrib/polaris): incorrect conversion between integer types (#3300)
* fix(contrib/polaris): convert string to int32 * fix
This commit is contained in:
parent
b3b2a3474a
commit
45603e3ab9
@ -114,7 +114,7 @@ func buildPolarisInstance(namespace string, nodes []selector.Node) *pb.ServiceIn
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
portInt, err := strconv.Atoi(port)
|
portUint64, err := strconv.ParseUint(port, 10, 32) //nolint:gomnd
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ func buildPolarisInstance(namespace string, nodes []selector.Node) *pb.ServiceIn
|
|||||||
Service: wrapperspb.String(node.ServiceName()),
|
Service: wrapperspb.String(node.ServiceName()),
|
||||||
Namespace: wrapperspb.String(namespace),
|
Namespace: wrapperspb.String(namespace),
|
||||||
Host: wrapperspb.String(host),
|
Host: wrapperspb.String(host),
|
||||||
Port: wrapperspb.UInt32(uint32(portInt)),
|
Port: wrapperspb.UInt32(uint32(portUint64)),
|
||||||
Protocol: wrapperspb.String(node.Scheme()),
|
Protocol: wrapperspb.String(node.Scheme()),
|
||||||
Version: wrapperspb.String(node.Version()),
|
Version: wrapperspb.String(node.Version()),
|
||||||
Weight: wrapperspb.UInt32(uint32(*node.InitialWeight())),
|
Weight: wrapperspb.UInt32(uint32(*node.InitialWeight())),
|
||||||
|
Loading…
Reference in New Issue
Block a user