From cf6a1b7b54f43506efbe5449ec171ba52377bf70 Mon Sep 17 00:00:00 2001 From: "Eric J. Holmes" Date: Tue, 16 Aug 2016 06:54:29 +0700 Subject: [PATCH 1/2] Switch to Go 1.7 --- Dockerfile | 4 ++-- README.md | 1 - circle.yml | 12 ++++++++++-- cmd/emp/README.md | 1 - cmd/emp/tls.go | 32 ++++++++++++++++++++++++++++++-- 5 files changed, 42 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1f5652ebc..32a9fa777 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ -FROM golang:1.5.3 +FROM golang:1.7 MAINTAINER Eric Holmes LABEL version 0.11.0 ADD . /go/src/github.com/remind101/empire WORKDIR /go/src/github.com/remind101/empire -RUN GO15VENDOREXPERIMENT=1 go install ./cmd/empire +RUN go install ./cmd/empire ENTRYPOINT ["/go/bin/empire"] CMD ["server"] diff --git a/README.md b/README.md index fb4a33a62..38cad8d05 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,6 @@ There is also a `tests` directory that contains integration and functional tests To get started, run: ```console -$ export GO15VENDOREXPERIMENT=1 $ make bootstrap ``` diff --git a/circle.yml b/circle.yml index dc1706601..268b94c60 100644 --- a/circle.yml +++ b/circle.yml @@ -1,8 +1,15 @@ machine: environment: - GO15VENDOREXPERIMENT: 1 + GODIST: "go1.7.linux-amd64.tar.gz" services: - docker + post: + - mkdir -p download + - test -e download/$GODIST || curl -o download/$GODIST https://storage.googleapis.com/golang/$GODIST + - sudo rm -rf /usr/local/go + - sudo tar -C /usr/local -xzf download/$GODIST + - sudo ln -s /usr/local/go/bin/go /usr/bin/go + - sudo go install -a -race std checkout: post: @@ -11,10 +18,11 @@ checkout: - cp -R ~/empire ~/.go_workspace/src/github.com/remind101/empire dependencies: + cache_directories: + - ~/download pre: - go get github.com/aktau/github-release - sudo pip install awscli - - go install -a -race std - go version - cd ~/.go_workspace/src/github.com/remind101/empire && make bootstrap override: diff --git a/cmd/emp/README.md b/cmd/emp/README.md index ba636b6b7..7374b75fc 100644 --- a/cmd/emp/README.md +++ b/cmd/emp/README.md @@ -21,7 +21,6 @@ $ brew install emp If you have a working Go 1.5+ environment, you can do the following: ```console -$ export GO15VENDOREXPERIMENT=1 # Required for Go 1.5.x $ go get -u github.com/remind101/empire/cmd/emp ``` diff --git a/cmd/emp/tls.go b/cmd/emp/tls.go index 20815b7e4..146c6804a 100644 --- a/cmd/emp/tls.go +++ b/cmd/emp/tls.go @@ -61,9 +61,9 @@ func tlsDialWithDialer(dialer *net.Dialer, network, addr string, config *tls.Con // from the hostname we're connecting to. if config.ServerName == "" { // Make a copy to avoid polluting argument or default. - c := *config + c := cloneTLSConfig(config) c.ServerName = hostname - config = &c + config = c } conn := tls.Client(rawConn, config) @@ -91,3 +91,31 @@ func tlsDialWithDialer(dialer *net.Dialer, network, addr string, config *tls.Con func tlsDial(network, addr string, config *tls.Config) (net.Conn, error) { return tlsDialWithDialer(new(net.Dialer), network, addr, config) } + +// Copied from https://golang.org/src/crypto/tls/common.go?s=9735:14940#L263, +// since the stdlib doesn't expose the `clone()` method. +func cloneTLSConfig(c *tls.Config) *tls.Config { + return &tls.Config{ + Rand: c.Rand, + Time: c.Time, + Certificates: c.Certificates, + NameToCertificate: c.NameToCertificate, + GetCertificate: c.GetCertificate, + RootCAs: c.RootCAs, + NextProtos: c.NextProtos, + ServerName: c.ServerName, + ClientAuth: c.ClientAuth, + ClientCAs: c.ClientCAs, + InsecureSkipVerify: c.InsecureSkipVerify, + CipherSuites: c.CipherSuites, + PreferServerCipherSuites: c.PreferServerCipherSuites, + SessionTicketsDisabled: c.SessionTicketsDisabled, + SessionTicketKey: c.SessionTicketKey, + ClientSessionCache: c.ClientSessionCache, + MinVersion: c.MinVersion, + MaxVersion: c.MaxVersion, + CurvePreferences: c.CurvePreferences, + DynamicRecordSizingDisabled: c.DynamicRecordSizingDisabled, + Renegotiation: c.Renegotiation, + } +} From df102644fa5d6d31bb6fd5428e8db34998406b75 Mon Sep 17 00:00:00 2001 From: "Eric J. Holmes" Date: Tue, 16 Aug 2016 08:59:51 +0700 Subject: [PATCH 2/2] Update CHANGELOG. --- CHANGELOG.md | 1 + Dockerfile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7d5e56bf..d7e06ae6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ **Improvements** * `emp ps` now displays the task's host. [#983](https://github.com/remind101/empire/pull/983) +* The `empire` and `emp` binaries are now built with Go 1.7 [#971](https://github.com/remind101/empire/pull/971) ## 0.11.0 (2016-08-22) diff --git a/Dockerfile b/Dockerfile index 32a9fa777..4cf9b1d2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.7 +FROM golang:1.7.0 MAINTAINER Eric Holmes LABEL version 0.11.0