Skip to content

Commit 19adada

Browse files
Fixed net
1 parent dbf5c06 commit 19adada

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,19 @@ func main() {
4848
kingpin.MustParse(app.Parse(os.Args[1:]))
4949

5050
address := *host
51+
net := "unix"
52+
if address != "localhost" {
53+
net = "tcp"
54+
}
5155
if *port != 0 {
52-
address += ":" + string(*port)
56+
address = fmt.Sprintf("%s:%d", address, *port)
5357
}
5458

5559
dsn := Config{
5660
User: *user,
5761
Passwd: *pass,
5862
Addr: address,
63+
Net: net,
5964
DBName: *dbName,
6065
ParseTime: true,
6166
}

0 commit comments

Comments
 (0)