From be7556aece965fcb22b6c7d706d757a571d71271 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Mon, 7 Nov 2022 15:06:34 -0500 Subject: [PATCH] tsnet/example/tshello: use strings.Cut (#6198) strings.Cut allows us to be more precise here. This example was written before strings.Cut existed. Signed-off-by: Xe Signed-off-by: Xe --- tsnet/example/tshello/tshello.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tsnet/example/tshello/tshello.go b/tsnet/example/tshello/tshello.go index 33db9f0bc..16131ef8a 100644 --- a/tsnet/example/tshello/tshello.go +++ b/tsnet/example/tshello/tshello.go @@ -57,8 +57,6 @@ func main() { } func firstLabel(s string) string { - if i := strings.Index(s, "."); i != -1 { - return s[:i] - } + s, _, _ = strings.Cut(s, ".") return s }