Skip to content

Commit 89150e1

Browse files
ldeztraefiker
authored andcommitted
Update to go1.13rc1
1 parent e1831c4 commit 89150e1

File tree

12 files changed

+127
-60
lines changed

12 files changed

+127
-60
lines changed

.golangci.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"gochecknoinits",
3838
"gochecknoglobals",
3939
"bodyclose", # Too many false-positive and panics.
40+
"typecheck", # v1.17.1 and Go1.13 => bug
4041
]
4142

4243
[issues]

.semaphoreci/golang.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
set -e
44

5-
curl -O https://dl.google.com/go/go1.12.linux-amd64.tar.gz
5+
curl -O https://dl.google.com/go/go"${GO_VERSION}".linux-amd64.tar.gz
66

7-
tar -xvf go1.12.linux-amd64.tar.gz
8-
rm -rf go1.12.linux-amd64.tar.gz
7+
tar -xvf go"${GO_VERSION}".linux-amd64.tar.gz
8+
rm -rf go"${GO_VERSION}".linux-amd64.tar.gz
99

10-
sudo mkdir -p /usr/local/golang/1.12/go
11-
sudo mv go /usr/local/golang/1.12/
10+
sudo mkdir -p /usr/local/golang/"${GO_VERSION}"/go
11+
sudo mv go /usr/local/golang/"${GO_VERSION}"/
1212

1313
sudo rm /usr/local/bin/go
14-
sudo chmod +x /usr/local/golang/1.12/go/bin/go
15-
sudo ln -s /usr/local/golang/1.12/go/bin/go /usr/local/bin/go
14+
sudo chmod +x /usr/local/golang/"${GO_VERSION}"/go/bin/go
15+
sudo ln -s /usr/local/golang/"${GO_VERSION}"/go/bin/go /usr/local/bin/go
1616

17-
export GOROOT="/usr/local/golang/1.12/go"
18-
export GOTOOLDIR="/usr/local/golang/1.12/go/pkg/tool/linux_amd64"
17+
export GOROOT="/usr/local/golang/${GO_VERSION}/go"
18+
export GOTOOLDIR="/usr/local/golang/${GO_VERSION}/go/pkg/tool/linux_amd64"
1919

2020
go version

.semaphoreci/setup.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ sudo dd if=/dev/zero of=/swapfile bs=1M count=3072
77
sudo mkswap /swapfile
88
sudo swapon /swapfile
99
sudo rm -rf /home/runner/.rbenv
10+
sudo rm -rf /usr/local/golang/{1.4.3,1.5.4,1.6.4,1.7.6,1.8.6,1.9.7,1.10.3,1.11}
1011
#export DOCKER_VERSION=18.06.3
1112
source .semaphoreci/vars
1213
if [ -z "${PULL_REQUEST_NUMBER}" ]; then SHOULD_TEST="-*-"; else TEMP_STORAGE=$(curl --silent https://patch-diff.githubusercontent.com/raw/containous/traefik/pull/${PULL_REQUEST_NUMBER}.diff | patch --dry-run -p1 -R || true); fi
@@ -16,12 +17,22 @@ echo ${TEMP_STORAGE}
1617
echo ${SHOULD_TEST}
1718
#if [ -n "$SHOULD_TEST" ]; then sudo -E apt-get -yq update; fi
1819
#if [ -n "$SHOULD_TEST" ]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install docker-ce=${DOCKER_VERSION}*; fi
19-
if [ -n "$SHOULD_TEST" ]; then docker version; fi
20+
if [ -n "$SHOULD_TEST" ]; then docker version; fi
21+
22+
export GO_VERSION=1.12
23+
if [ -f "./go.mod" ]; then GO_VERSION="$(grep '^go .*' go.mod | awk '{print $2}')"; export GO_VERSION; fi
24+
if [ "${GO_VERSION}" == '1.13' ]; then export GO_VERSION=1.13rc1; fi
25+
echo "Selected Go version: ${GO_VERSION}"
26+
2027
if [ -f "./.semaphoreci/golang.sh" ]; then ./.semaphoreci/golang.sh; fi
21-
if [ -f "./.semaphoreci/golang.sh" ]; then export GOROOT="/usr/local/golang/1.12/go"; fi
22-
if [ -f "./.semaphoreci/golang.sh" ]; then export GOTOOLDIR="/usr/local/golang/1.12/go/pkg/tool/linux_amd64"; fi
28+
if [ -f "./.semaphoreci/golang.sh" ]; then export GOROOT="/usr/local/golang/${GO_VERSION}/go"; fi
29+
if [ -f "./.semaphoreci/golang.sh" ]; then export GOTOOLDIR="/usr/local/golang/${GO_VERSION}/go/pkg/tool/linux_amd64"; fi
30+
go version
31+
2332
if [ -f "./go.mod" ]; then export GO111MODULE=on; fi
2433
if [ -f "./go.mod" ]; then export GOPROXY=https://proxy.golang.org; fi
2534
if [ -f "./go.mod" ]; then go mod download; fi
26-
sudo rm -rf /usr/local/golang/1.4.3/ /usr/local/golang/1.5.4/ /usr/local/golang/1.6.4 /usr/local/golang/1.7.6 /usr/local/golang/1.8.6 /usr/local/golang/1.9.7 /usr/local/golang/1.10.3
35+
2736
df
37+
38+

build.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.12-alpine
1+
FROM golang:1.13rc1-alpine
22

33
RUN apk --update upgrade \
44
&& apk --no-cache --no-progress add git mercurial bash gcc musl-dev curl tar ca-certificates tzdata \

cmd/traefik/traefik.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@ import (
3333
"github.com/vulcand/oxy/roundrobin"
3434
)
3535

36-
func init() {
37-
goDebug := os.Getenv("GODEBUG")
38-
if len(goDebug) > 0 {
39-
goDebug += ","
40-
}
41-
os.Setenv("GODEBUG", goDebug+"tls13=1")
42-
}
43-
4436
func main() {
4537
// traefik config inits
4638
tConfig := cmd.NewTraefikConfiguration()

docs/content/contributing/building-testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Successfully tagged traefik-webui:latest
2828
[...]
2929
docker build -t "traefik-dev:4475--feature-documentation" -f build.Dockerfile .
3030
Sending build context to Docker daemon 279MB
31-
Step 1/10 : FROM golang:1.12-alpine
31+
Step 1/10 : FROM golang:1.13rc1-alpine
3232
---> f4bfb3d22bda
3333
[...]
3434
Successfully built 5c3c1a911277
@@ -60,7 +60,7 @@ PRE_TARGET= make test-unit
6060

6161
Requirements:
6262

63-
- `go` v1.12+
63+
- `go` v1.13+
6464
- environment variable `GO111MODULE=on`
6565

6666
!!! tip "Source Directory"

exp.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RUN yarn install
1212
RUN npm run build
1313

1414
# BUILD
15-
FROM golang:1.12-alpine as gobuild
15+
FROM golang:1.13rc1-alpine as gobuild
1616

1717
RUN apk --update upgrade \
1818
&& apk --no-cache --no-progress add git mercurial bash gcc musl-dev curl tar ca-certificates tzdata \

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/containous/traefik/v2
22

3-
go 1.12
3+
go 1.13
44

55
require (
66
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect

integration/fixtures/https/clientca/https_2ca1config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
[http.services.service1]
3232
[http.services.service1.loadBalancer]
3333
[[http.services.service1.loadBalancer.servers]]
34-
url = "http://127.0.0.1:9010"
34+
url = "{{ .Server1 }}"
3535

3636
[http.services.service2]
3737
[http.services.service2.loadBalancer]
3838
[[http.services.service2.loadBalancer.servers]]
39-
url = "http://127.0.0.1:9020"
39+
url = "{{ .Server2 }}"
4040

4141
[[tls.certificates]]
4242
certFile = "fixtures/https/snitest.com.cert"

integration/fixtures/https/clientca/https_2ca2config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
[http.services.service1]
3131
[http.services.service1.loadBalancer]
3232
[[http.services.service1.loadBalancer.servers]]
33-
url = "http://127.0.0.1:9010"
33+
url = "{{ .Server1 }}"
3434

3535
[http.services.service2]
3636
[http.services.service2.loadBalancer]
3737
[[http.services.service2.loadBalancer.servers]]
38-
url = "http://127.0.0.1:9020"
38+
url = "{{ .Server2 }}"
3939

4040
[[tls.certificates]]
4141
certFile = "fixtures/https/snitest.com.cert"

integration/https_test.go

Lines changed: 91 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,21 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthentication(c *check.C) {
501501
// TestWithClientCertificateAuthentication
502502
// Use two CA:s and test that clients with client signed by either of them can connect
503503
func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAs(c *check.C) {
504-
file := s.adaptFile(c, "fixtures/https/clientca/https_2ca1config.toml", struct{}{})
504+
server1 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { rw.Write([]byte("server1")) }))
505+
server2 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { rw.Write([]byte("server2")) }))
506+
defer func() {
507+
server1.Close()
508+
server2.Close()
509+
}()
510+
511+
file := s.adaptFile(c, "fixtures/https/clientca/https_2ca1config.toml", struct {
512+
Server1 string
513+
Server2 string
514+
}{
515+
Server1: server1.URL,
516+
Server2: server2.URL,
517+
})
518+
505519
defer os.Remove(file)
506520
cmd, display := s.traefikCmd(withConfigFile(file))
507521
defer display(c)
@@ -513,58 +527,91 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAs(c *check
513527
err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 1*time.Second, try.BodyContains("Host(`snitest.org`)"))
514528
c.Assert(err, checker.IsNil)
515529

530+
req, err := http.NewRequest(http.MethodGet, "https://127.0.0.1:4443", nil)
531+
c.Assert(err, checker.IsNil)
532+
req.Host = "snitest.com"
533+
516534
tlsConfig := &tls.Config{
517535
InsecureSkipVerify: true,
518536
ServerName: "snitest.com",
519537
Certificates: []tls.Certificate{},
520538
}
539+
540+
client := http.Client{
541+
Transport: &http.Transport{TLSClientConfig: tlsConfig},
542+
Timeout: 1 * time.Second,
543+
}
544+
521545
// Connection without client certificate should fail
522-
_, err = tls.Dial("tcp", "127.0.0.1:4443", tlsConfig)
523-
c.Assert(err, checker.NotNil, check.Commentf("should not be allowed to connect to server"))
546+
_, err = client.Do(req)
547+
c.Assert(err, checker.NotNil)
524548

525-
// Connect with client signed by ca1
526549
cert, err := tls.LoadX509KeyPair("fixtures/https/clientca/client1.crt", "fixtures/https/clientca/client1.key")
527550
c.Assert(err, checker.IsNil, check.Commentf("unable to load client certificate and key"))
528551
tlsConfig.Certificates = append(tlsConfig.Certificates, cert)
529552

530-
conn, err := tls.Dial("tcp", "127.0.0.1:4443", tlsConfig)
531-
c.Assert(err, checker.IsNil, check.Commentf("failed to connect to server"))
532-
533-
conn.Close()
553+
// Connect with client signed by ca1
554+
_, err = client.Do(req)
555+
c.Assert(err, checker.IsNil)
534556

535557
// Connect with client signed by ca2
536558
tlsConfig = &tls.Config{
537559
InsecureSkipVerify: true,
538560
ServerName: "snitest.com",
539561
Certificates: []tls.Certificate{},
540562
}
563+
541564
cert, err = tls.LoadX509KeyPair("fixtures/https/clientca/client2.crt", "fixtures/https/clientca/client2.key")
542565
c.Assert(err, checker.IsNil, check.Commentf("unable to load client certificate and key"))
543566
tlsConfig.Certificates = append(tlsConfig.Certificates, cert)
544567

545-
conn, err = tls.Dial("tcp", "127.0.0.1:4443", tlsConfig)
546-
c.Assert(err, checker.IsNil, check.Commentf("failed to connect to server"))
568+
client = http.Client{
569+
Transport: &http.Transport{TLSClientConfig: tlsConfig},
570+
Timeout: 1 * time.Second,
571+
}
547572

548-
conn.Close()
573+
// Connect with client signed by ca1
574+
_, err = client.Do(req)
575+
c.Assert(err, checker.IsNil)
549576

550577
// Connect with client signed by ca3 should fail
551578
tlsConfig = &tls.Config{
552579
InsecureSkipVerify: true,
553580
ServerName: "snitest.com",
554581
Certificates: []tls.Certificate{},
555582
}
583+
556584
cert, err = tls.LoadX509KeyPair("fixtures/https/clientca/client3.crt", "fixtures/https/clientca/client3.key")
557585
c.Assert(err, checker.IsNil, check.Commentf("unable to load client certificate and key"))
558586
tlsConfig.Certificates = append(tlsConfig.Certificates, cert)
559587

560-
_, err = tls.Dial("tcp", "127.0.0.1:4443", tlsConfig)
561-
c.Assert(err, checker.NotNil, check.Commentf("should not be allowed to connect to server"))
588+
client = http.Client{
589+
Transport: &http.Transport{TLSClientConfig: tlsConfig},
590+
Timeout: 1 * time.Second,
591+
}
592+
593+
// Connect with client signed by ca1
594+
_, err = client.Do(req)
595+
c.Assert(err, checker.NotNil)
562596
}
563597

564598
// TestWithClientCertificateAuthentication
565599
// Use two CA:s in two different files and test that clients with client signed by either of them can connect
566600
func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAsMultipleFiles(c *check.C) {
567-
file := s.adaptFile(c, "fixtures/https/clientca/https_2ca2config.toml", struct{}{})
601+
server1 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { rw.Write([]byte("server1")) }))
602+
server2 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { rw.Write([]byte("server2")) }))
603+
defer func() {
604+
server1.Close()
605+
server2.Close()
606+
}()
607+
608+
file := s.adaptFile(c, "fixtures/https/clientca/https_2ca2config.toml", struct {
609+
Server1 string
610+
Server2 string
611+
}{
612+
Server1: server1.URL,
613+
Server2: server2.URL,
614+
})
568615
defer os.Remove(file)
569616
cmd, display := s.traefikCmd(withConfigFile(file))
570617
defer display(c)
@@ -576,51 +623,70 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAsMultipleF
576623
err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 1*time.Second, try.BodyContains("Host(`snitest.org`)"))
577624
c.Assert(err, checker.IsNil)
578625

626+
req, err := http.NewRequest(http.MethodGet, "https://127.0.0.1:4443", nil)
627+
c.Assert(err, checker.IsNil)
628+
req.Host = "snitest.com"
629+
579630
tlsConfig := &tls.Config{
580631
InsecureSkipVerify: true,
581632
ServerName: "snitest.com",
582633
Certificates: []tls.Certificate{},
583634
}
635+
636+
client := http.Client{
637+
Transport: &http.Transport{TLSClientConfig: tlsConfig},
638+
Timeout: 1 * time.Second,
639+
}
640+
584641
// Connection without client certificate should fail
585-
_, err = tls.Dial("tcp", "127.0.0.1:4443", tlsConfig)
586-
c.Assert(err, checker.NotNil, check.Commentf("should not be allowed to connect to server"))
642+
_, err = client.Do(req)
643+
c.Assert(err, checker.NotNil)
587644

588645
// Connect with client signed by ca1
589646
cert, err := tls.LoadX509KeyPair("fixtures/https/clientca/client1.crt", "fixtures/https/clientca/client1.key")
590647
c.Assert(err, checker.IsNil, check.Commentf("unable to load client certificate and key"))
591648
tlsConfig.Certificates = append(tlsConfig.Certificates, cert)
592649

593-
conn, err := tls.Dial("tcp", "127.0.0.1:4443", tlsConfig)
594-
c.Assert(err, checker.IsNil, check.Commentf("failed to connect to server"))
595-
596-
conn.Close()
650+
_, err = client.Do(req)
651+
c.Assert(err, checker.IsNil)
597652

598653
// Connect with client signed by ca2
599654
tlsConfig = &tls.Config{
600655
InsecureSkipVerify: true,
601656
ServerName: "snitest.com",
602657
Certificates: []tls.Certificate{},
603658
}
659+
604660
cert, err = tls.LoadX509KeyPair("fixtures/https/clientca/client2.crt", "fixtures/https/clientca/client2.key")
605661
c.Assert(err, checker.IsNil, check.Commentf("unable to load client certificate and key"))
606662
tlsConfig.Certificates = append(tlsConfig.Certificates, cert)
607663

608-
conn, err = tls.Dial("tcp", "127.0.0.1:4443", tlsConfig)
609-
c.Assert(err, checker.IsNil, check.Commentf("failed to connect to server"))
610-
conn.Close()
664+
client = http.Client{
665+
Transport: &http.Transport{TLSClientConfig: tlsConfig},
666+
Timeout: 1 * time.Second,
667+
}
668+
669+
_, err = client.Do(req)
670+
c.Assert(err, checker.IsNil)
611671

612672
// Connect with client signed by ca3 should fail
613673
tlsConfig = &tls.Config{
614674
InsecureSkipVerify: true,
615675
ServerName: "snitest.com",
616676
Certificates: []tls.Certificate{},
617677
}
678+
618679
cert, err = tls.LoadX509KeyPair("fixtures/https/clientca/client3.crt", "fixtures/https/clientca/client3.key")
619680
c.Assert(err, checker.IsNil, check.Commentf("unable to load client certificate and key"))
620681
tlsConfig.Certificates = append(tlsConfig.Certificates, cert)
621682

622-
_, err = tls.Dial("tcp", "127.0.0.1:4443", tlsConfig)
623-
c.Assert(err, checker.NotNil, check.Commentf("should not be allowed to connect to server"))
683+
client = http.Client{
684+
Transport: &http.Transport{TLSClientConfig: tlsConfig},
685+
Timeout: 1 * time.Second,
686+
}
687+
688+
_, err = client.Do(req)
689+
c.Assert(err, checker.NotNil)
624690
}
625691

626692
func (s *HTTPSSuite) TestWithRootCAsContentForHTTPSOnBackend(c *check.C) {

integration/integration_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ var host = flag.Bool("host", false, "run host integration tests")
2727
var showLog = flag.Bool("tlog", false, "always show Traefik logs")
2828

2929
func Test(t *testing.T) {
30-
check.TestingT(t)
31-
}
32-
33-
func init() {
34-
flag.Parse()
3530
if !*integration {
3631
log.Info("Integration tests disabled.")
3732
return
@@ -69,6 +64,8 @@ func init() {
6964
check.Suite(&ProxyProtocolSuite{})
7065
check.Suite(&TCPSuite{})
7166
}
67+
68+
check.TestingT(t)
7269
}
7370

7471
var traefikBinary = "../dist/traefik"

0 commit comments

Comments
 (0)