mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
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:
@@ -14,7 +14,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func setLogBuffer() *bytes.Buffer {
|
func setLogBuffer() *bytes.Buffer {
|
||||||
@@ -27,26 +26,13 @@ func setLogBuffer() *bytes.Buffer {
|
|||||||
return &buf
|
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 {
|
func GetContainerHostIP() string {
|
||||||
dockerHost := os.Getenv("DOCKER_HOST")
|
dockerHost := os.Getenv("DOCKER_HOST")
|
||||||
if dockerHost == "" {
|
if dockerHost == "" {
|
||||||
return "127.0.0.1"
|
return "127.0.0.1"
|
||||||
}
|
}
|
||||||
parts, _ := url.Parse(dockerHost)
|
parts, _ := url.Parse(dockerHost)
|
||||||
return stripPort(parts.Host)
|
return parts.Hostname()
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test(t *testing.T, ds models.Datastore) {
|
func Test(t *testing.T, ds models.Datastore) {
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ checkout:
|
|||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
pre:
|
pre:
|
||||||
- wget https://storage.googleapis.com/golang/go1.7.1.linux-amd64.tar.gz
|
- wget https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
|
||||||
- mkdir -p $HOME/golang
|
- mkdir -p $HOME/golang
|
||||||
- tar -C $HOME/golang -xvzf go1.7.1.linux-amd64.tar.gz
|
- tar -C $HOME/golang -xvzf go1.8.linux-amd64.tar.gz
|
||||||
- wget https://github.com/Masterminds/glide/releases/download/v0.12.3/glide-v0.12.3-linux-amd64.tar.gz
|
- wget https://github.com/Masterminds/glide/releases/download/v0.12.3/glide-v0.12.3-linux-amd64.tar.gz
|
||||||
- tar -C $HOME/bin -xvzf glide-v0.12.3-linux-amd64.tar.gz --strip=1
|
- tar -C $HOME/bin -xvzf glide-v0.12.3-linux-amd64.tar.gz --strip=1
|
||||||
override:
|
override:
|
||||||
|
|||||||
Reference in New Issue
Block a user