Skip to content

Commit dc7e1df

Browse files
committed
Migrate go code to function in go 1.22+
1 parent 9b8c0fc commit dc7e1df

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

.github/workflows/build-publish-python-packages.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- uses: actions/checkout@v4
6969
- uses: actions/setup-go@v5
7070
with:
71-
go-version: "1.21"
71+
go-version: "1.23"
7272
cache-dependency-path: "**/*.sum"
7373
- uses: actions/setup-python@v5
7474
with:

.github/workflows/test.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ jobs:
5858
# that would be fine.
5959
#
6060
- python-version: "3.10"
61-
go-version: "1.20"
61+
go-version: "1.22"
6262
- python-version: "3.11"
63-
go-version: "1.20"
63+
go-version: "1.22"
6464
- python-version: "3.12"
65-
go-version: "1.21"
65+
go-version: "1.23"
6666
- python-version: "3.13"
67-
go-version: "1.21"
67+
go-version: "1.23"
6868

6969
steps:
7070
- uses: actions/checkout@v4

dask-gateway-server/dask-gateway-proxy/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module github.com/dask/dask-gateway/dask-gateway-proxy
22

3-
go 1.21
3+
go 1.22
44

5-
require github.com/stretchr/testify v1.8.4
5+
require github.com/stretchr/testify v1.10.0
66

77
require (
88
github.com/davecgh/go-spew v1.1.1 // indirect

dask-gateway-server/dask-gateway-proxy/pkg/sni/sni.go

+13
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ import (
88
"net"
99
)
1010

11+
// hideWriteTo is a workaround introduced to make the code functional in 1.22+,
12+
// where io.Copy would no longer make use of peekedTCPConn.Read after
13+
// net.TCPConn.WriteTo was added, so the workaround is to hide it again.
14+
//
15+
// The workaround was developed inspecting:
16+
// https://github.com/golang/go/commit/f664031bc17629080332a1c7bede38d67fd32e47
17+
//
18+
type hideWriteTo struct{}
19+
func (hideWriteTo) WriteTo(io.Writer) (int64, error) {
20+
panic("can't happen")
21+
}
22+
1123
type TcpConn interface {
1224
net.Conn
1325
CloseWrite() error
@@ -16,6 +28,7 @@ type TcpConn interface {
1628

1729
type peekedTCPConn struct {
1830
peeked []byte
31+
hideWriteTo
1932
*net.TCPConn
2033
}
2134

0 commit comments

Comments
 (0)