From 2ae1bec85c5188c03473db107eaf992743c48d59 Mon Sep 17 00:00:00 2001 From: Yingchun Lai Date: Thu, 14 Mar 2024 10:12:51 +0800 Subject: [PATCH] 2 --- go-client/idl/base/host_port.go | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/go-client/idl/base/host_port.go b/go-client/idl/base/host_port.go index 997d5d000d..22b721815e 100644 --- a/go-client/idl/base/host_port.go +++ b/go-client/idl/base/host_port.go @@ -21,15 +21,16 @@ package base import ( "fmt" + "github.com/apache/thrift/lib/go/thrift" ) -type HostPortType int +type HostPortType int32 const ( - HOST_TYPE_INVALID HostPortType = 0 // itoa - HOST_TYPE_IPV4 = 1 - HOST_TYPE_GROUP = 2 + HOST_TYPE_INVALID HostPortType = iota + HOST_TYPE_IPV4 + HOST_TYPE_GROUP ) type HostPort struct { @@ -83,13 +84,6 @@ func (r *HostPort) Write(oprot thrift.TProtocol) error { return nil } -func (r *HostPort) String() string { - if r == nil { - return "" - } - return fmt.Sprintf("HostPort(%s:%d)", r.GetHost(), r.GetPort()) -} - func (r *HostPort) GetHost() string { return r.host } @@ -98,6 +92,13 @@ func (r *HostPort) GetPort() uint16 { return r.port } +func (r *HostPort) String() string { + if r == nil { + return "" + } + return fmt.Sprintf("HostPort(%s:%d)", r.host, r.port) +} + func (r *HostPort) GetHostPort() string { - return fmt.Sprintf("%s:%d", r.GetHost(), r.GetPort()) + return fmt.Sprintf("%s:%d", r.host, r.port) }