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

x/crypto/ssh: ssh/server_test.go uses "slices", introduced in go 1.21, but go 1.20 supported #68469

Closed
imirkin opened this issue Jul 16, 2024 · 3 comments
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@imirkin
Copy link

imirkin commented Jul 16, 2024

Go version

go version go1.20.13 linux/amd64

Output of go env in your module/workspace:

GOVERSION="go1.20.13"
GOROOT="/usr/lib/go"

What did you do?

git clone https://go.googlesource.com/crypto
go test ./...

What did you see happen?

ssh/server_test.go:12:2: package slices is not in GOROOT (/usr/lib/go/src/slices)
FAIL golang.org/x/crypto/ssh [setup failed]

What did you expect to see?

Success.

The go.mod file lists "go 1.20" as a minimum requirement. However it's not possible to run the tests.

@gopherbot gopherbot added this to the Unreleased milestone Jul 16, 2024
@imirkin
Copy link
Author

imirkin commented Jul 16, 2024

A minimal patch:

diff --git a/ssh/server_test.go b/ssh/server_test.go
index 9057a9b..b6d8ab3 100644
--- a/ssh/server_test.go
+++ b/ssh/server_test.go
@@ -9,7 +9,7 @@ import (
        "fmt"
        "io"
        "net"
-       "slices"
+       "reflect"
        "strings"
        "sync/atomic"
        "testing"
@@ -294,7 +294,7 @@ func TestBannerError(t *testing.T) {
                "banner from PublicKeyCallback",
                "banner from KeyboardInteractiveCallback",
        }
-       if !slices.Equal(banners, wantBanners) {
+       if !reflect.DeepEqual(banners, wantBanners) {
                t.Errorf("got banners:\n%q\nwant banners:\n%q", banners, wantBanners)
        }
 }

I realize it's a lot less efficient, but it's a short list and it'll be easy to switch it back to slices when go 1.21+ is required?

@seankhliao
Copy link
Member

cc @drakkan @golang/security

@seankhliao seankhliao added the NeedsFix The path to resolution is known, but the work has not been done. label Jul 16, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/598775 mentions this issue: ssh: remove go 1.21+ dependency on slices

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants