|
|
@ -20,7 +20,6 @@ import (
|
|
|
|
"net/url"
|
|
|
|
"net/url"
|
|
|
|
"path"
|
|
|
|
"path"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// URLJoin joins a base URL to one or more path components.
|
|
|
|
// URLJoin joins a base URL to one or more path components.
|
|
|
@ -70,18 +69,5 @@ func ExtractHostname(addr string) (string, error) {
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
return "", err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return stripPort(u.Host), nil
|
|
|
|
return u.Hostname(), 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]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|