Merge pull request #5856 from bacongobbler/remove-stripport

ref(urlutil): remove stripPort
pull/5869/head
Matthew Fisher 5 years ago committed by GitHub
commit 7d3693bd56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,7 +20,6 @@ import (
"net/url"
"path"
"path/filepath"
"strings"
)
// URLJoin joins a base URL to one or more path components.
@ -70,18 +69,5 @@ func ExtractHostname(addr string) (string, error) {
if err != nil {
return "", err
}
return stripPort(u.Host), nil
}
// Backported from Go 1.8 because Circle is still on 1.7
func stripPort(hostport string) string {
colon := strings.IndexByte(hostport, ':')
if colon == -1 {
return hostport
}
if i := strings.IndexByte(hostport, ']'); i != -1 {
return strings.TrimPrefix(hostport[:i], "[")
}
return hostport[:colon]
return u.Hostname(), nil
}

Loading…
Cancel
Save