Update to Go1.12

Co-authored-by: juliens <julien@containo.us>
This commit is contained in:
Ludovic Fernandez 2019-03-01 11:48:04 +01:00 committed by Traefiker Bot
parent 5a0b5470e7
commit fb617044e0
10 changed files with 43 additions and 40 deletions

20
.semaphoreci/golang.sh Executable file
View file

@ -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

View file

@ -69,7 +69,7 @@ test-integration: build ## run the integration tests
TEST_HOST=1 ./script/make.sh test-integration TEST_HOST=1 ./script/make.sh test-integration
validate: build ## validate code, vendor and autogen 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 build: dist
docker build $(DOCKER_BUILD_ARGS) -t "$(TRAEFIK_DEV_IMAGE)" -f build.Dockerfile . docker build $(DOCKER_BUILD_ARGS) -t "$(TRAEFIK_DEV_IMAGE)" -f build.Dockerfile .

View file

@ -1,11 +1,10 @@
FROM golang:1.11-alpine FROM golang:1.12-alpine
RUN apk --update upgrade \ RUN apk --update upgrade \
&& apk --no-cache --no-progress add git mercurial bash gcc musl-dev curl tar \ && apk --no-cache --no-progress add git mercurial bash gcc musl-dev curl tar \
&& rm -rf /var/cache/apk/* && rm -rf /var/cache/apk/*
RUN go get golang.org/x/lint/golint \ RUN go get golang.org/x/lint/golint \
&& go get github.com/kisielk/errcheck \
&& go get github.com/client9/misspell/cmd/misspell && go get github.com/client9/misspell/cmd/misspell
# Which docker version to test on # Which docker version to test on

View file

@ -43,6 +43,14 @@ import (
"github.com/vulcand/oxy/roundrobin" "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 // sliceOfStrings is the parser for []string
type sliceOfStrings []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. // Set's argument is a string to be parsed to set the flag.
// It's a comma-separated list, so we split it. // It's a comma-separated list, so we split it.
func (s *sliceOfStrings) Set(value string) error { func (s *sliceOfStrings) Set(value string) error {
strings := strings.Split(value, ",") parts := strings.Split(value, ",")
if len(strings) == 0 { if len(parts) == 0 {
return fmt.Errorf("bad []string format: %s", value) return fmt.Errorf("bad []string format: %s", value)
} }
for _, entrypoint := range strings { for _, entrypoint := range parts {
*s = append(*s, entrypoint) *s = append(*s, entrypoint)
} }
return nil return nil

View file

@ -28,7 +28,7 @@ Successfully tagged traefik-webui:latest
[...] [...]
docker build -t "traefik-dev:4475--feature-documentation" -f build.Dockerfile . docker build -t "traefik-dev:4475--feature-documentation" -f build.Dockerfile .
Sending build context to Docker daemon 279MB Sending build context to Docker daemon 279MB
Step 1/10 : FROM golang:1.11-alpine Step 1/10 : FROM golang:1.12-alpine
---> f4bfb3d22bda ---> f4bfb3d22bda
[...] [...]
Successfully built 5c3c1a911277 Successfully built 5c3c1a911277

View file

@ -330,7 +330,7 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthentication(c *check.C) {
// TestWithClientCertificateAuthentication // TestWithClientCertificateAuthentication
// Use two CA:s and test that clients with client signed by either of them can connect // 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")) cmd, display := s.traefikCmd(withConfigFile("fixtures/https/clientca/https_2ca1config.toml"))
defer display(c) defer display(c)
err := cmd.Start() err := cmd.Start()
@ -391,7 +391,7 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipeCAs(c *check.
// TestWithClientCertificateAuthentication // TestWithClientCertificateAuthentication
// Use two CA:s in two different files and test that clients with client signed by either of them can connect // 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")) cmd, display := s.traefikCmd(withConfigFile("fixtures/https/clientca/https_2ca2config.toml"))
defer display(c) defer display(c)
err := cmd.Start() err := cmd.Start()

View file

@ -3,9 +3,8 @@ set -e
# List of bundles to create when no argument is passed # List of bundles to create when no argument is passed
DEFAULT_BUNDLES=( DEFAULT_BUNDLES=(
validate-gofmt
validate-govet
generate generate
validate-gofmt
binary binary
test-unit test-unit

View file

@ -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

View file

@ -9,7 +9,7 @@ unset IFS
errors=() errors=()
for f in "${files[@]}"; do for f in "${files[@]}"; do
# we use "git show" here to validate that what's committed passes go vet # 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 if [ "$failedVet" ]; then
errors+=( "$failedVet" ) errors+=( "$failedVet" )
fi fi

View file

@ -19,6 +19,7 @@ var (
`VersionTLS10`: tls.VersionTLS10, `VersionTLS10`: tls.VersionTLS10,
`VersionTLS11`: tls.VersionTLS11, `VersionTLS11`: tls.VersionTLS11,
`VersionTLS12`: tls.VersionTLS12, `VersionTLS12`: tls.VersionTLS12,
`VersionTLS13`: tls.VersionTLS13,
} }
// CipherSuites Map of TLS CipherSuites from crypto/tls // 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_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_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_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,
} }
) )