Skip to content

Commit

Permalink
Update to Go1.12
Browse files Browse the repository at this point in the history
Co-authored-by: juliens <julien@containo.us>
  • Loading branch information
2 people authored and traefiker committed Mar 1, 2019
1 parent 5a0b547 commit fb61704
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 40 deletions.
20 changes: 20 additions & 0 deletions .semaphoreci/golang.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
3 changes: 1 addition & 2 deletions build.Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 11 additions & 3 deletions cmd/traefik/traefik.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/content/contributing/building-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions integration/https_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 1 addition & 2 deletions script/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 0 additions & 28 deletions script/validate-errcheck

This file was deleted.

2 changes: 1 addition & 1 deletion script/validate-govet
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions tls/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
}
)

Expand Down

0 comments on commit fb61704

Please sign in to comment.