Merge pull request #38519 from dims/fix-url-parse-in-golang-1.8

Automatic merge from submit-queue (batch tested with PRs 37677, 38519)

Better deal with failures under golang 1.8beta1

If there is any error in the initial parsing then we should just
try adding the scheme.

url.Parse(base) has changed in 1.8. Please see the following change
c5ccbdd22b

Fixes #38380
This commit is contained in:
Kubernetes Submit Queue 2016-12-09 15:03:10 -08:00 committed by GitHub
commit beb895f2cd

View File

@ -33,10 +33,7 @@ func DefaultServerURL(host, apiPath string, groupVersion schema.GroupVersion, de
}
base := host
hostURL, err := url.Parse(base)
if err != nil {
return nil, "", err
}
if hostURL.Scheme == "" || hostURL.Host == "" {
if err != nil || hostURL.Scheme == "" || hostURL.Host == "" {
scheme := "http://"
if defaultTLS {
scheme = "https://"