Skip to content

Commit c564c21

Browse files
committed
drop support for go1.17 and older
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 7cbebcf commit c564c21

10 files changed

Lines changed: 24 additions & 20 deletions

File tree

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
go: ["1.13.x", "1.20.x", "1.21.x"]
17+
go: ["1.18.x", "1.20.x", "1.21.x"]
1818
platform: [ubuntu-20.04]
1919
runs-on: ${{ matrix.platform }}
2020
steps:
@@ -37,7 +37,7 @@ jobs:
3737
strategy:
3838
fail-fast: false
3939
matrix:
40-
go: ["1.13.x", "1.20.x", "1.21.x"]
40+
go: ["1.18.x", "1.20.x", "1.21.x"]
4141
platform: [windows-latest, macos-latest]
4242
runs-on: ${{ matrix.platform }}
4343
steps:

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module github.com/docker/go-connections
22

3-
go 1.13
3+
go 1.18
44

55
require github.com/Microsoft/go-winio v0.4.14
6+
7+
require golang.org/x/sys v0.1.0 // indirect

go.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB
88
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
99
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
1010
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
11-
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b h1:ag/x1USPSsqHud38I9BAC88qdNLDHHtQ4mlgQIZPPNA=
1211
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
12+
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
13+
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

nat/nat_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ func TestParsePortRangeToInt(t *testing.T) {
9494

9595
func TestPort(t *testing.T) {
9696
p, err := NewPort("tcp", "1234")
97-
9897
if err != nil {
9998
t.Fatalf("tcp, 1234 had a parsing issue: %v", err)
10099
}

proxy/network_proxy_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ import (
1111
"time"
1212
)
1313

14-
var testBuf = []byte("Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo")
15-
var testBufSize = len(testBuf)
14+
var (
15+
testBuf = []byte("Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo")
16+
testBufSize = len(testBuf)
17+
)
1618

1719
type EchoServer interface {
1820
Run()

proxy/tcp_proxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (proxy *TCPProxy) clientLoop(client *net.TCPConn, quit chan bool) {
4646
}
4747

4848
event := make(chan int64)
49-
var broker = func(to, from *net.TCPConn) {
49+
broker := func(to, from *net.TCPConn) {
5050
written, err := io.Copy(to, from)
5151
if err != nil {
5252
// If the socket we are writing to is shutdown with

sockets/sockets_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build !windows
1+
//go:build !windows
22

33
package sockets
44

sockets/unix_socket.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// +build !windows
1+
//go:build !windows
22

33
/*
44
Package sockets is a simple unix domain socket wrapper.
55
6-
Usage
6+
# Usage
77
88
For example:
99
@@ -103,7 +103,7 @@ func NewUnixSocketWithOpts(path string, opts ...SockOption) (net.Listener, error
103103
// We don't use "defer" here, to reset the umask to its original value as soon
104104
// as possible. Ideally we'd be able to detect if WithChmod() was passed as
105105
// an option, and skip changing umask if default permissions are used.
106-
origUmask := syscall.Umask(0777)
106+
origUmask := syscall.Umask(0o777)
107107
l, err := net.Listen("unix", path)
108108
syscall.Umask(origUmask)
109109
if err != nil {
@@ -122,5 +122,5 @@ func NewUnixSocketWithOpts(path string, opts ...SockOption) (net.Listener, error
122122

123123
// NewUnixSocket creates a unix socket with the specified path and group.
124124
func NewUnixSocket(path string, gid int) (net.Listener, error) {
125-
return NewUnixSocketWithOpts(path, WithChown(0, gid), WithChmod(0660))
125+
return NewUnixSocketWithOpts(path, WithChown(0, gid), WithChmod(0o660))
126126
}

sockets/unix_socket_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build !windows
1+
//go:build !windows
22

33
package sockets
44

@@ -53,7 +53,7 @@ func TestNewUnixSocket(t *testing.T) {
5353

5454
func TestUnixSocketWithOpts(t *testing.T) {
5555
uid, gid := os.Getuid(), os.Getgid()
56-
perms := os.FileMode(0660)
56+
perms := os.FileMode(0o660)
5757
path := "/tmp/test.sock"
5858
echoStr := "hello"
5959
l, err := NewUnixSocketWithOpts(path, WithChown(uid, gid), WithChmod(perms))

tlsconfig/config_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func TestConfigServerTLSServerCertsOnly(t *testing.T) {
127127
if !reflect.DeepEqual(tlsConfig.CipherSuites, DefaultServerAcceptedCiphers) {
128128
t.Fatal("Unexpected server cipher suites")
129129
}
130-
if !tlsConfig.PreferServerCipherSuites {
130+
if !tlsConfig.PreferServerCipherSuites { //nolint:staticcheck // Ignore SA1019: tlsConfig.PreferServerCipherSuites has been deprecated since Go 1.18: PreferServerCipherSuites is ignored.
131131
t.Fatal("Expected server to prefer cipher suites")
132132
}
133133
if tlsConfig.MinVersion != tls.VersionTLS12 {
@@ -158,7 +158,7 @@ func TestConfigServerTLSClientCANotSetIfClientAuthTooLow(t *testing.T) {
158158
if tlsConfig.ClientAuth != tls.RequestClientCert {
159159
t.Fatal("ClientAuth was not set to what was in the options")
160160
}
161-
if tlsConfig.ClientCAs != nil {
161+
if tlsConfig.ClientCAs != nil { //nolint:staticcheck // Ignore SA1019: tlsConfig.ClientCAs.Subjects has been deprecated since Go 1.18: if s was returned by SystemCertPool, Subjects will not include the system roots.
162162
t.Fatalf("Client CAs should never have been set")
163163
}
164164
}
@@ -191,7 +191,7 @@ func TestConfigServerTLSClientCASet(t *testing.T) {
191191
basePool = x509.NewCertPool()
192192
}
193193
// because we are not enabling `ExclusiveRootPools`, any root pool will also contain the system roots
194-
if tlsConfig.ClientCAs == nil || len(tlsConfig.ClientCAs.Subjects()) != len(basePool.Subjects())+2 {
194+
if tlsConfig.ClientCAs == nil || len(tlsConfig.ClientCAs.Subjects()) != len(basePool.Subjects())+2 { //nolint:staticcheck // Ignore SA1019: tlsConfig.ClientCAs.Subjects has been deprecated since Go 1.18: if s was returned by SystemCertPool, Subjects will not include the system roots.
195195
t.Fatalf("Client CAs were never set correctly")
196196
}
197197
}
@@ -394,7 +394,7 @@ func TestConfigClientTLSNoVerify(t *testing.T) {
394394
t.Fatal("Unable to configure client TLS", err)
395395
}
396396

397-
if tlsConfig.RootCAs != nil {
397+
if tlsConfig.RootCAs != nil { //nolint:staticcheck // Ignore SA1019: tlsConfig.RootCAs.Subjects has been deprecated since Go 1.18: if s was returned by SystemCertPool, Subjects will not include the system roots.
398398
t.Fatal("Should not have set Root CAs", err)
399399
}
400400

@@ -449,7 +449,7 @@ func TestConfigClientTLSRootCAFileWithOneCert(t *testing.T) {
449449
basePool = x509.NewCertPool()
450450
}
451451
// because we are not enabling `ExclusiveRootPools`, any root pool will also contain the system roots
452-
if tlsConfig.RootCAs == nil || len(tlsConfig.RootCAs.Subjects()) != len(basePool.Subjects())+2 {
452+
if tlsConfig.RootCAs == nil || len(tlsConfig.RootCAs.Subjects()) != len(basePool.Subjects())+2 { //nolint:staticcheck // Ignore SA1019: tlsConfig.ClientCAs.Subjects has been deprecated since Go 1.18: if s was returned by SystemCertPool, Subjects will not include the system roots.
453453
t.Fatal("Root CAs not set properly", err)
454454
}
455455
if tlsConfig.Certificates != nil {

0 commit comments

Comments
 (0)