mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-21 06:01:42 +00:00
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 <xe@tailscale.com> Signed-off-by: Xe <xe@tailscale.com>
This commit is contained in:
parent
c2d7940ec0
commit
be7556aece
@ -57,8 +57,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func firstLabel(s string) string {
|
func firstLabel(s string) string {
|
||||||
if i := strings.Index(s, "."); i != -1 {
|
s, _, _ = strings.Cut(s, ".")
|
||||||
return s[:i]
|
|
||||||
}
|
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user