Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit 93cc1f1

Browse files
committed
Upgrade to golang 1.14
Close #328
1 parent 54fb6c6 commit 93cc1f1

File tree

3 files changed

+7
-28
lines changed

3 files changed

+7
-28
lines changed

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
language: go
22
os: linux
3-
go: 1.9.x
4-
3+
go:
4+
- "1.14"
55
sudo: required
6-
76
services:
87
- docker
98

Dockerfile.build

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# Dockerfile used to build a build step that builds container-diff in CI.
2-
FROM golang:1.9
2+
FROM golang:1.14
33
RUN apt-get update && apt-get install make
4-
RUN mkdir -p /go/src/github.com/GoogleContainerTools/
5-
RUN ln -s /workspace /go/src/github.com/GoogleContainerTools/container-diff
6-
WORKDIR /go/src/github.com/GoogleContainerTools/container-diff
4+
WORKDIR /workspace

pkg/util/transport_builder.go

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@ package util
1919
import (
2020
"crypto/tls"
2121
"crypto/x509"
22+
. "github.com/google/go-containerregistry/pkg/name"
2223
"github.com/sirupsen/logrus"
2324
"io/ioutil"
24-
"net"
2525
"net/http"
26-
"time"
27-
28-
. "github.com/google/go-containerregistry/pkg/name"
2926
)
3027

3128
var tlsConfiguration = struct {
@@ -48,7 +45,8 @@ func ConfigureTLS(skipTsVerifyRegistries []string, registriesToCertificates map[
4845
}
4946

5047
func BuildTransport(registry Registry) http.RoundTripper {
51-
var tr http.RoundTripper = newTransport()
48+
var tr http.RoundTripper = http.DefaultTransport.(*http.Transport).Clone()
49+
5250
if _, present := tlsConfiguration.skipTLSVerifyRegistries[registry.RegistryStr()]; present {
5351
tr.(*http.Transport).TLSClientConfig = &tls.Config{
5452
InsecureSkipVerify: true,
@@ -66,22 +64,6 @@ func BuildTransport(registry Registry) http.RoundTripper {
6664
return tr
6765
}
6866

69-
// TODO replace it with "http.DefaultTransport.(*http.Transport).Clone()" once in golang 1.12
70-
func newTransport() http.RoundTripper {
71-
return &http.Transport{
72-
Proxy: http.ProxyFromEnvironment,
73-
DialContext: (&net.Dialer{
74-
Timeout: 30 * time.Second,
75-
KeepAlive: 30 * time.Second,
76-
DualStack: true,
77-
}).DialContext,
78-
MaxIdleConns: 100,
79-
IdleConnTimeout: 90 * time.Second,
80-
TLSHandshakeTimeout: 10 * time.Second,
81-
ExpectContinueTimeout: 1 * time.Second,
82-
}
83-
}
84-
8567
func appendCertificate(pool *x509.CertPool, path string) error {
8668
pem, err := ioutil.ReadFile(path)
8769
if err != nil {

0 commit comments

Comments
 (0)