Switch to Go 1.8 installation inside CI (#589)

* Switch to Go 1.8 installation inside CI

Partially Addresses: #588

* Use url.Hostname() instead of custom method
This commit is contained in:
Denis Makogon
2017-03-15 21:07:03 +02:00
committed by U Cirello
parent 35af509da9
commit 2a0e9f4b9c
2 changed files with 3 additions and 17 deletions

View File

@@ -14,7 +14,6 @@ import (
"net/http"
"os"
"net/url"
"strings"
)
func setLogBuffer() *bytes.Buffer {
@@ -27,26 +26,13 @@ func setLogBuffer() *bytes.Buffer {
return &buf
}
// workaround for parts.Hostname() that doesn't work on Go1.7.1
// TODO(denismakogon): remove this after switching to Go 1.8
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]
}
func GetContainerHostIP() string {
dockerHost := os.Getenv("DOCKER_HOST")
if dockerHost == "" {
return "127.0.0.1"
}
parts, _ := url.Parse(dockerHost)
return stripPort(parts.Host)
return parts.Hostname()
}
func Test(t *testing.T, ds models.Datastore) {