Skip to content

Commit 481d3d2

Browse files
authored
Merge pull request #107 from thaJeztah/drop_legacy_go
tlsconfig: drop support for go1.17 and older
2 parents 3518605 + 9548f9f commit 481d3d2

17 files changed

Lines changed: 52 additions & 99 deletions

.github/workflows/test.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ 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:
2121
- name: Install Go ${{ matrix.go }}
22-
uses: actions/setup-go@v2
22+
uses: actions/setup-go@v4
2323
with:
2424
go-version: ${{ matrix.go }}
2525
- name: Setup IPv6
2626
run: sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 net.ipv6.conf.default.disable_ipv6=0 net.ipv6.conf.all.disable_ipv6=0
2727
- name: Checkout code
28-
uses: actions/checkout@v2
28+
uses: actions/checkout@v4
2929
- name: Build for ${{ matrix.platform }}
3030
run: go build ./...
3131
- name: Test
@@ -37,16 +37,16 @@ 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:
4444
- name: Install Go ${{ matrix.go }}
45-
uses: actions/setup-go@v2
45+
uses: actions/setup-go@v4
4646
with:
4747
go-version: ${{ matrix.go }}
4848
- name: Checkout code
49-
uses: actions/checkout@v2
49+
uses: actions/checkout@v4
5050
- name: Build for ${{ matrix.platform }}
5151
run: go build ./...
5252
- name: Test
@@ -61,8 +61,13 @@ jobs:
6161
platform: [ubuntu-20.04, windows-latest, macos-latest]
6262
runs-on: ${{ matrix.platform }}
6363
steps:
64-
- uses: actions/checkout@v2
65-
- uses: golangci/golangci-lint-action@v2
64+
- uses: actions/checkout@v4
65+
- uses: actions/setup-go@v4
66+
with:
67+
go-version: "1.21.x"
68+
cache: false
69+
- name: golangci-lint
70+
uses: golangci/golangci-lint-action@v3
6671
with:
6772
# must be specified without patch version
6873
version: v1.55

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))
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// +build go1.7
2-
31
package tlsconfig
42

53
import (

0 commit comments

Comments
 (0)