From def2baade5a4af58e3444cf6c923b1e4de584329 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Wed, 3 May 2023 12:22:27 -0600 Subject: add JoinDefaultPort for servers' configuration --- spartan/serve.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'spartan') diff --git a/spartan/serve.go b/spartan/serve.go index 61199b1..a477a45 100644 --- a/spartan/serve.go +++ b/spartan/serve.go @@ -7,7 +7,6 @@ import ( "fmt" "io" "net" - "strings" sr "tildegit.org/tjp/sliderule" "tildegit.org/tjp/sliderule/internal" @@ -32,9 +31,8 @@ func NewServer( ) (sr.Server, error) { ss := &spartanServer{handler: handler} - if strings.IndexByte(hostname, ':') < 0 { - hostname = net.JoinHostPort(hostname, "300") - } + hostname = internal.JoinDefaultPort(hostname, "300") + address = internal.JoinDefaultPort(address, "300") var err error ss.Server, err = internal.NewServer(ctx, hostname, network, address, errLog, ss.handleConn) -- cgit v1.2.3