File tree 3 files changed +7
-3
lines changed
3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 5
5
"github.com/mattfenwick/cyclonus/pkg/matcher"
6
6
"github.com/pkg/errors"
7
7
v1 "k8s.io/api/core/v1"
8
+ "net"
9
+ "strconv"
8
10
)
9
11
10
12
type Jobs struct {
@@ -51,7 +53,7 @@ func (j *Job) Key() string {
51
53
}
52
54
53
55
func (j * Job ) ToAddress () string {
54
- return fmt . Sprintf ( "%s:%d" , j .ToHost , j .ResolvedPort )
56
+ return net . JoinHostPort ( j .ToHost , strconv . Itoa ( j .ResolvedPort ) )
55
57
}
56
58
57
59
func (j * Job ) ClientCommand () []string {
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ func NewDefaultClient(host string) *Client {
51
51
52
52
func NewClient(host string, port int) *Client {
53
53
return &Client{Resty: resty.New().
54
- SetHostURL(fmt.Sprintf("%s:%d", host, port)).
54
+ SetHostURL(net.JoinHostPort( host, strconv.Itoa( port) )).
55
55
//SetDebug(false).
56
56
SetTimeout(30 * time.Second)}
57
57
}
Original file line number Diff line number Diff line change 4
4
"fmt"
5
5
"github.com/pkg/errors"
6
6
v1 "k8s.io/api/core/v1"
7
+ "net"
8
+ "strconv"
7
9
)
8
10
9
11
type Batch struct {
@@ -44,7 +46,7 @@ type Request struct {
44
46
}
45
47
46
48
func (r * Request ) Address () string {
47
- return fmt . Sprintf ( "%s:%d" , r .Host , r .Port )
49
+ return net . JoinHostPort ( r .Host , strconv . Itoa ( r .Port ) )
48
50
}
49
51
50
52
func (r * Request ) Command () []string {
You can’t perform that action at this time.
0 commit comments