File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ import (
1818 "github.com/pkg/errors"
1919 "go.uber.org/zap"
2020 "golang.org/x/sync/errgroup"
21- "net"
2221 "os"
2322 "os/signal"
2423 "sync"
@@ -64,7 +63,7 @@ func run() int {
6463 }
6564 defer db .Close ()
6665 {
67- logger .Infof ("Connecting to database at '%s'" , net .JoinHostPort (cmd .Config .Database .Host , fmt . Sprint ( cmd .Config .Database .Port ) ))
66+ logger .Infof ("Connecting to database at '%s'" , utils .JoinHostPort (cmd .Config .Database .Host , cmd .Config .Database .Port ))
6867 err := db .Ping ()
6968 if err != nil {
7069 logger .Fatalf ("%+v" , errors .Wrap (err , "can't connect to database" ))
@@ -80,7 +79,7 @@ func run() int {
8079 logger .Fatalf ("%+v" , errors .Wrap (err , "can't create Redis client from config" ))
8180 }
8281 {
83- logger .Infof ("Connecting to Redis at '%s'" , net .JoinHostPort (cmd .Config .Redis .Host , fmt . Sprint ( cmd .Config .Redis .Port ) ))
82+ logger .Infof ("Connecting to Redis at '%s'" , utils .JoinHostPort (cmd .Config .Redis .Host , cmd .Config .Redis .Port ))
8483 _ , err := rc .Ping (context .Background ()).Result ()
8584 if err != nil {
8685 logger .Fatalf ("%+v" , errors .Wrap (err , "can't connect to Redis" ))
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
1010 "github.com/pkg/errors"
1111 "golang.org/x/exp/utf8string"
1212 "math"
13+ "net"
1314 "os"
1415 "path/filepath"
1516 "strings"
@@ -206,3 +207,12 @@ func MaxInt(x, y int) int {
206207
207208 return y
208209}
210+
211+ // JoinHostPort is like its equivalent in net., but handles UNIX sockets as well.
212+ func JoinHostPort (host string , port int ) string {
213+ if strings .HasPrefix (host , "/" ) {
214+ return host
215+ }
216+
217+ return net .JoinHostPort (host , fmt .Sprint (port ))
218+ }
You can’t perform that action at this time.
0 commit comments