Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate go code to function in go 1.22+ #873

Merged
merged 2 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-publish-python-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.23"
cache-dependency-path: "**/*.sum"
- uses: actions/setup-python@v5
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:
# that would be fine.
#
- python-version: "3.10"
go-version: "1.20"
go-version: "1.22"
- python-version: "3.11"
go-version: "1.20"
go-version: "1.22"
- python-version: "3.12"
go-version: "1.21"
go-version: "1.23"
- python-version: "3.13"
go-version: "1.21"
go-version: "1.23"

steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 5 additions & 2 deletions continuous_integration/docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
FROM centos:7

ARG python_version="3.11"
ARG go_version="1.19"
# go_version was 1.19 until it was updated to 1.23.6 (2025-02-07) by adding a
# layer on top of the previous image, as it is no longer able to build and it
# was an easy way to update the golang version.
ARG go_version="1.23.6"

# Set labels based on the Open Containers Initiative (OCI):
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
Expand Down Expand Up @@ -66,7 +69,7 @@ RUN yum install -y bzip2 \
&& rm -rf /var/cache/yum

# Install go
RUN curl -sL https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz \
RUN curl -sL https://go.dev/dl/go${go_version}.linux-amd64.tar.gz \
| tar --extract --verbose --gzip --directory=/opt/

# Put Python and Go environments on PATH
Expand Down
4 changes: 2 additions & 2 deletions dask-gateway-server/dask-gateway-proxy/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/dask/dask-gateway/dask-gateway-proxy

go 1.21
go 1.22

require github.com/stretchr/testify v1.8.4
require github.com/stretchr/testify v1.10.0

require (
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down
13 changes: 13 additions & 0 deletions dask-gateway-server/dask-gateway-proxy/pkg/sni/sni.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ import (
"net"
)

// hideWriteTo is a workaround introduced to make the code functional in 1.22+,
// where io.Copy would no longer make use of peekedTCPConn.Read after
// net.TCPConn.WriteTo was added, so the workaround is to hide it again.
//
// The workaround was developed inspecting:
// https://github.com/golang/go/commit/f664031bc17629080332a1c7bede38d67fd32e47
//
type hideWriteTo struct{}
func (hideWriteTo) WriteTo(io.Writer) (int64, error) {
panic("can't happen")
}

type TcpConn interface {
net.Conn
CloseWrite() error
Expand All @@ -16,6 +28,7 @@ type TcpConn interface {

type peekedTCPConn struct {
peeked []byte
hideWriteTo
*net.TCPConn
}

Expand Down