Skip to content

Commit cd0c059

Browse files
authored
Merge pull request #152 from thaJeztah/bump_go_version
update minimum go version to go1.23
2 parents dad033c + 9be976c commit cd0c059

File tree

6 files changed

+7
-8
lines changed

6 files changed

+7
-8
lines changed

go.mod

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

3-
go 1.18
3+
go 1.23
44

55
require (
66
github.com/Microsoft/go-winio v0.4.21

nat/nat.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func ParsePortSpec(rawPort string) ([]PortMapping, error) {
218218
count := endPort - startPort + 1
219219
ports := make([]PortMapping, 0, count)
220220

221-
for i := 0; i < count; i++ {
221+
for i := range count {
222222
hPort := ""
223223
if hostPort != "" {
224224
hPort = strconv.Itoa(startHostPort + i)

nat/sort.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ func SortPortMap(ports []Port, bindings map[Port][]PortBinding) {
6969
portInt, portProto := p.Int(), p.Proto()
7070
if binding, ok := bindings[p]; ok && len(binding) > 0 {
7171
for _, b := range binding {
72-
b := b // capture loop variable for go < 1.22
7372
s = append(s, portMapEntry{
7473
port: p, binding: &b,
7574
portInt: portInt, portProto: portProto,

nat/sort_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func BenchmarkSortPortMap(b *testing.B) {
8383
ports := make([]Port, 0, n*2)
8484
portMap := make(map[Port][]PortBinding, n*2)
8585

86-
for i := 0; i < n; i++ {
86+
for i := range n {
8787
portNum := 30000 + (i % 50) // force duplicate port numbers
8888
tcp := Port(fmt.Sprintf("%d/tcp", portNum))
8989
udp := Port(fmt.Sprintf("%d/udp", portNum))

proxy/logger.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package proxy
22

33
type logger interface {
4-
Printf(format string, args ...interface{})
4+
Printf(format string, args ...any)
55
}
66

77
type noopLogger struct{}
88

9-
func (l *noopLogger) Printf(_ string, _ ...interface{}) {
9+
func (l *noopLogger) Printf(_ string, _ ...any) {
1010
// Do nothing :)
1111
}

tlsconfig/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func TestConfigServerTLSFailsIfUnableToLoadCerts(t *testing.T) {
7777
_ = tempFile.Close()
7878

7979
for _, badFile := range []string{"not-a-file", tempFile.Name()} {
80-
for i := 0; i < 3; i++ {
80+
for i := range 3 {
8181
files := []string{cert, key, ca}
8282
files[i] = badFile
8383

@@ -475,7 +475,7 @@ func TestConfigClientTLSClientCertOrKeyInvalid(t *testing.T) {
475475
defer func() { _ = os.Remove(tempFile.Name()) }()
476476
_ = tempFile.Close()
477477

478-
for i := 0; i < 2; i++ {
478+
for i := range 2 {
479479
for _, invalid := range []string{"not-a-file", "", tempFile.Name()} {
480480
files := []string{cert, key}
481481
files[i] = invalid

0 commit comments

Comments
 (0)