diff options
| author | cuiweixie <cuiweixie@gmail.com> | 2022-09-03 14:29:35 +0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-09-07 01:48:30 +0000 |
| commit | 4fe4601d37179facbf7e79627ef9d6a236364505 (patch) | |
| tree | d857d550d18c9a4f4f35af582c4aa84afdecbde5 /src/runtime/debuglog.go | |
| parent | 2ee075dc47ec686b48746fd261212b044705fcdc (diff) | |
| download | go-4fe4601d37179facbf7e79627ef9d6a236364505.tar.xz | |
runtime: simplify code using unsafe.{Slice,String}
Updates #54854
Change-Id: Ie18665e93e477b6f220acf4c6c070b2af4343064
Reviewed-on: https://go-review.googlesource.com/c/go/+/428157
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/runtime/debuglog.go')
| -rw-r--r-- | src/runtime/debuglog.go | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/runtime/debuglog.go b/src/runtime/debuglog.go index 028d77ad41..83d5a3e9e6 100644 --- a/src/runtime/debuglog.go +++ b/src/runtime/debuglog.go @@ -657,11 +657,7 @@ func (r *debugLogReader) printVal() bool { case debugLogConstString: len, ptr := int(r.uvarint()), uintptr(r.uvarint()) ptr += firstmoduledata.etext - str := stringStruct{ - str: unsafe.Pointer(ptr), - len: len, - } - s := *(*string)(unsafe.Pointer(&str)) + s := unsafe.String((*byte)(unsafe.Pointer(ptr)), len) print(s) case debugLogStringOverflow: |
