From 2ee075dc47ec686b48746fd261212b044705fcdc Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Sat, 3 Sep 2022 14:35:41 +0800 Subject: strings: simplify code using unsafe.StringData Updates #54854 Change-Id: I93396dc92bd2decba895f2d059e1aeffcd22312c Reviewed-on: https://go-review.googlesource.com/c/go/+/428158 Run-TryBot: Bryan Mills TryBot-Result: Gopher Robot Auto-Submit: Bryan Mills Reviewed-by: Bryan Mills Reviewed-by: Robert Griesemer --- src/strings/strings_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/strings/strings_test.go') diff --git a/src/strings/strings_test.go b/src/strings/strings_test.go index 6d394f47be..8af81a556b 100644 --- a/src/strings/strings_test.go +++ b/src/strings/strings_test.go @@ -660,8 +660,7 @@ func TestMap(t *testing.T) { } orig := "Input string that we expect not to be copied." m = Map(identity, orig) - if (*reflect.StringHeader)(unsafe.Pointer(&orig)).Data != - (*reflect.StringHeader)(unsafe.Pointer(&m)).Data { + if unsafe.StringData(orig) != unsafe.StringData(m) { t.Error("unexpected copy during identity map") } -- cgit v1.3