2
0

Make use of strings.Cut

This commit is contained in:
Ville Skyttä
2023-10-04 20:41:55 +03:00
parent 163eb68866
commit 24ed0e4257
6 changed files with 25 additions and 33 deletions
+1 -3
View File
@@ -69,9 +69,7 @@ func TestScript(t *testing.T) {
}
}()
parts := strings.Split(ln.Addr().String(), ":")
host := parts[0]
port := parts[1]
host, port, _ := strings.Cut(ln.Addr().String(), ":")
connStr := fmt.Sprintf("sslmode=disable host=%s port=%s", host, port)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)