From fb617044e0221b7f9f0665d4c8adaa3736335cf4 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Fri, 1 Mar 2019 11:48:04 +0100 Subject: [PATCH] Update to Go1.12 Co-authored-by: juliens --- .semaphoreci/golang.sh | 20 +++++++++++++ Makefile | 2 +- build.Dockerfile | 3 +- cmd/traefik/traefik.go | 14 ++++++++-- docs/content/contributing/building-testing.md | 2 +- integration/https_test.go | 4 +-- script/make.sh | 3 +- script/validate-errcheck | 28 ------------------- script/validate-govet | 2 +- tls/certificate.go | 5 ++++ 10 files changed, 43 insertions(+), 40 deletions(-) create mode 100755 .semaphoreci/golang.sh delete mode 100755 script/validate-errcheck diff --git a/.semaphoreci/golang.sh b/.semaphoreci/golang.sh new file mode 100755 index 000000000..ec24aac57 --- /dev/null +++ b/.semaphoreci/golang.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e + +curl -O https://dl.google.com/go/go1.12.linux-amd64.tar.gz + +tar -xvf go1.12.linux-amd64.tar.gz +rm -rf go1.12.linux-amd64.tar.gz + +sudo mkdir -p /usr/local/golang/1.12/go +sudo mv go /usr/local/golang/1.12/ + +sudo rm /usr/local/bin/go +sudo chmod +x /usr/local/golang/1.12/go/bin/go +sudo ln -s /usr/local/golang/1.12/go/bin/go /usr/local/bin/go + +export GOROOT="/usr/local/golang/1.12/go" +export GOTOOLDIR="/usr/local/golang/1.12/go/pkg/tool/linux_amd64" + +go version diff --git a/Makefile b/Makefile index d84f0aacb..2ceb322d2 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,7 @@ test-integration: build ## run the integration tests TEST_HOST=1 ./script/make.sh test-integration validate: build ## validate code, vendor and autogen - $(DOCKER_RUN_TRAEFIK) ./script/make.sh validate-gofmt validate-govet validate-golint validate-misspell validate-vendor validate-autogen + $(DOCKER_RUN_TRAEFIK) ./script/make.sh validate-gofmt validate-golint validate-misspell validate-vendor validate-autogen build: dist docker build $(DOCKER_BUILD_ARGS) -t "$(TRAEFIK_DEV_IMAGE)" -f build.Dockerfile . diff --git a/build.Dockerfile b/build.Dockerfile index 656baca64..386aae731 100644 --- a/build.Dockerfile +++ b/build.Dockerfile @@ -1,11 +1,10 @@ -FROM golang:1.11-alpine +FROM golang:1.12-alpine RUN apk --update upgrade \ && apk --no-cache --no-progress add git mercurial bash gcc musl-dev curl tar \ && rm -rf /var/cache/apk/* RUN go get golang.org/x/lint/golint \ -&& go get github.com/kisielk/errcheck \ && go get github.com/client9/misspell/cmd/misspell # Which docker version to test on diff --git a/cmd/traefik/traefik.go b/cmd/traefik/traefik.go index 6f7f1b375..fea984995 100644 --- a/cmd/traefik/traefik.go +++ b/cmd/traefik/traefik.go @@ -43,6 +43,14 @@ import ( "github.com/vulcand/oxy/roundrobin" ) +func init() { + goDebug := os.Getenv("GODEBUG") + if len(goDebug) > 0 { + goDebug += "," + } + os.Setenv("GODEBUG", goDebug+"tls13=1") +} + // sliceOfStrings is the parser for []string type sliceOfStrings []string @@ -56,11 +64,11 @@ func (s *sliceOfStrings) String() string { // Set's argument is a string to be parsed to set the flag. // It's a comma-separated list, so we split it. func (s *sliceOfStrings) Set(value string) error { - strings := strings.Split(value, ",") - if len(strings) == 0 { + parts := strings.Split(value, ",") + if len(parts) == 0 { return fmt.Errorf("bad []string format: %s", value) } - for _, entrypoint := range strings { + for _, entrypoint := range parts { *s = append(*s, entrypoint) } return nil diff --git a/docs/content/contributing/building-testing.md b/docs/content/contributing/building-testing.md index 418642b96..a01fa8b1f 100644 --- a/docs/content/contributing/building-testing.md +++ b/docs/content/contributing/building-testing.md @@ -28,7 +28,7 @@ Successfully tagged traefik-webui:latest [...] docker build -t "traefik-dev:4475--feature-documentation" -f build.Dockerfile . Sending build context to Docker daemon 279MB -Step 1/10 : FROM golang:1.11-alpine +Step 1/10 : FROM golang:1.12-alpine ---> f4bfb3d22bda [...] Successfully built 5c3c1a911277 diff --git a/integration/https_test.go b/integration/https_test.go index c8ec67958..32e6c451a 100644 --- a/integration/https_test.go +++ b/integration/https_test.go @@ -330,7 +330,7 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthentication(c *check.C) { // TestWithClientCertificateAuthentication // Use two CA:s and test that clients with client signed by either of them can connect -func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipeCAs(c *check.C) { +func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAs(c *check.C) { cmd, display := s.traefikCmd(withConfigFile("fixtures/https/clientca/https_2ca1config.toml")) defer display(c) err := cmd.Start() @@ -391,7 +391,7 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipeCAs(c *check. // TestWithClientCertificateAuthentication // Use two CA:s in two different files and test that clients with client signed by either of them can connect -func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipeCAsMultipleFiles(c *check.C) { +func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAsMultipleFiles(c *check.C) { cmd, display := s.traefikCmd(withConfigFile("fixtures/https/clientca/https_2ca2config.toml")) defer display(c) err := cmd.Start() diff --git a/script/make.sh b/script/make.sh index 7c8ca397f..580dab74f 100755 --- a/script/make.sh +++ b/script/make.sh @@ -3,9 +3,8 @@ set -e # List of bundles to create when no argument is passed DEFAULT_BUNDLES=( - validate-gofmt - validate-govet generate + validate-gofmt binary test-unit diff --git a/script/validate-errcheck b/script/validate-errcheck deleted file mode 100755 index f7cefc61c..000000000 --- a/script/validate-errcheck +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -source "$(dirname "$BASH_SOURCE")/.validate" - -IFS=$'\n' -files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) ) -unset IFS - -errors=() -failedErrcheck=$(errcheck .) -if [ "$failedErrcheck" ]; then - errors+=( "$failedErrcheck" ) -fi - -if [ ${#errors[@]} -eq 0 ]; then - echo 'Congratulations! All Go source files have been errchecked.' -else - { - echo "Errors from errcheck:" - for err in "${errors[@]}"; do - echo "$err" - done - echo - echo 'Please fix the above errors. You can test via "errcheck" and commit the result.' - echo - } >&2 - false -fi diff --git a/script/validate-govet b/script/validate-govet index 6d526ad74..060df2075 100755 --- a/script/validate-govet +++ b/script/validate-govet @@ -9,7 +9,7 @@ unset IFS errors=() for f in "${files[@]}"; do # we use "git show" here to validate that what's committed passes go vet - failedVet=$(go tool vet -printf=false "$f") + failedVet=$(go vet -printf=false "$f") if [ "$failedVet" ]; then errors+=( "$failedVet" ) fi diff --git a/tls/certificate.go b/tls/certificate.go index 452502f68..d2b17b753 100644 --- a/tls/certificate.go +++ b/tls/certificate.go @@ -19,6 +19,7 @@ var ( `VersionTLS10`: tls.VersionTLS10, `VersionTLS11`: tls.VersionTLS11, `VersionTLS12`: tls.VersionTLS12, + `VersionTLS13`: tls.VersionTLS13, } // CipherSuites Map of TLS CipherSuites from crypto/tls @@ -46,6 +47,10 @@ var ( `TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384`: tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, `TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305`: tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, `TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305`: tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, + "TLS_AES_128_GCM_SHA256": tls.TLS_AES_128_GCM_SHA256, + "TLS_AES_256_GCM_SHA384": tls.TLS_AES_256_GCM_SHA384, + "TLS_CHACHA20_POLY1305_SHA256": tls.TLS_CHACHA20_POLY1305_SHA256, + "TLS_FALLBACK_SCSV": tls.TLS_FALLBACK_SCSV, } )