diff options
| author | cuiweixie <cuiweixie@gmail.com> | 2022-09-03 14:35:41 +0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-09-07 01:33:55 +0000 |
| commit | 2ee075dc47ec686b48746fd261212b044705fcdc (patch) | |
| tree | dafd7bee1731faec7444a22b5fabfedefdd4cc53 /src/strings/strings_test.go | |
| parent | 92b8f4e293421b3b61e868d593a89315c788c327 (diff) | |
| download | go-2ee075dc47ec686b48746fd261212b044705fcdc.tar.xz | |
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 <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Diffstat (limited to 'src/strings/strings_test.go')
| -rw-r--r-- | src/strings/strings_test.go | 3 |
1 files changed, 1 insertions, 2 deletions
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") } |
