Update supported go versions
Client: go
With the release of go 1.23, update supported go versions to 1.22+1.23
according to our go support policy.
Also update the code to use the new range loop feature introduced in go
1.22 when appropriate.
Also fix a bug in TSSLServerSocket.Addr that it does not return the
listener address.
diff --git a/test/go/src/bin/testclient/main.go b/test/go/src/bin/testclient/main.go
index 95fcd47..a71223c 100644
--- a/test/go/src/bin/testclient/main.go
+++ b/test/go/src/bin/testclient/main.go
@@ -20,8 +20,10 @@
package main
import (
+ "bytes"
"context"
"flag"
+ "fmt"
t "log"
"reflect"
@@ -41,11 +43,15 @@
func main() {
flag.Parse()
- client, _, err := common.StartClient(*host, *port, *domain_socket, *transport, *protocol, *ssl)
+ addr := *domain_socket
+ if addr == "" {
+ addr = fmt.Sprintf("%s:%d", *host, *port)
+ }
+ client, _, err := common.StartClient(addr, *transport, *protocol, *ssl)
if err != nil {
t.Fatalf("Unable to start client: ", err)
}
- for i := 0; i < *testloops; i++ {
+ for range *testloops {
callEverything(client)
}
}
@@ -127,17 +133,15 @@
}
binout := make([]byte, 256)
- for i := 0; i < 256; i++ {
+ for i := range binout {
binout[i] = byte(i)
}
bin, err := client.TestBinary(defaultCtx, binout)
if err != nil {
t.Fatalf("TestBinary failed with %v", err)
}
- for i := 0; i < 256; i++ {
- if binout[i] != bin[i] {
- t.Fatalf("Unexpected TestBinary() result expected %d, got %d ", binout[i], bin[i])
- }
+ if !bytes.Equal(binout, bin) {
+ t.Fatalf("Unexpected TestBinary() result expected % 02x, got % 02x ", binout, bin)
}
uout := thrift.Tuuid{