File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,10 @@ package main
3
3
import (
4
4
"flag"
5
5
"fmt"
6
+ "net"
6
7
"os"
7
8
"os/signal"
9
+ "strconv"
8
10
"strings"
9
11
"syscall"
10
12
"time"
@@ -38,7 +40,7 @@ func main() {
38
40
flag .Parse ()
39
41
40
42
cfg := canal .NewDefaultConfig ()
41
- cfg .Addr = fmt . Sprintf ( "%s:%d" , * host , * port )
43
+ cfg .Addr = net . JoinHostPort ( * host , strconv . Itoa ( * port ) )
42
44
cfg .User = * user
43
45
cfg .Password = * password
44
46
cfg .Flavor = * flavor
Original file line number Diff line number Diff line change 7
7
"fmt"
8
8
"net"
9
9
"os"
10
+ "strconv"
10
11
"sync"
11
12
"time"
12
13
@@ -866,7 +867,7 @@ func (b *BinlogSyncer) LastConnectionID() uint32 {
866
867
func (b * BinlogSyncer ) newConnection () (* client.Conn , error ) {
867
868
var addr string
868
869
if b .cfg .Port != 0 {
869
- addr = fmt . Sprintf ( "%s:%d" , b .cfg .Host , b .cfg .Port )
870
+ addr = net . JoinHostPort ( b .cfg .Host , strconv . Itoa ( int ( b .cfg .Port )) )
870
871
} else {
871
872
addr = b .cfg .Host
872
873
}
You can’t perform that action at this time.
0 commit comments