hostinfo, net/netcheck: use CutPrefix

Updates #5309

Change-Id: I37e594cfd245784bf810c493de68a66d3ff20677
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2022-08-05 15:08:32 -07:00
committed by Brad Fitzpatrick
parent 01e8ef7293
commit ec9d13bce5
5 changed files with 7 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import (
"tailscale.com/net/stun"
"tailscale.com/net/stun/stuntest"
"tailscale.com/tailcfg"
"tailscale.com/util/strs"
)
func TestHairpinSTUN(t *testing.T) {
@ -616,7 +617,7 @@ func TestLogConciseReport(t *testing.T) {
var buf bytes.Buffer
c := &Client{Logf: func(f string, a ...any) { fmt.Fprintf(&buf, f, a...) }}
c.logConciseReport(tt.r, dm)
if got := strings.TrimPrefix(buf.String(), "[v1] report: "); got != tt.want {
if got, ok := strs.CutPrefix(buf.String(), "[v1] report: "); !ok {
t.Errorf("unexpected result.\n got: %#q\nwant: %#q\n", got, tt.want)
}
})