mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
all: document legacy //go:linkname for modules with ≥20,000 dependents
For #67401. Change-Id: Icc10ede72547d8020c0ba45e89d954822a4b2455 Reviewed-on: https://go-review.googlesource.com/c/go/+/587218 Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
2f07d44556
commit
bde905af5b
18 changed files with 207 additions and 1 deletions
|
|
@ -17,6 +17,7 @@ import (
|
|||
"unicode"
|
||||
"unicode/utf16"
|
||||
"unicode/utf8"
|
||||
_ "unsafe" // for linkname
|
||||
)
|
||||
|
||||
// Unmarshal parses the JSON-encoded data and stores the result
|
||||
|
|
@ -1178,6 +1179,15 @@ func unquote(s []byte) (t string, ok bool) {
|
|||
return
|
||||
}
|
||||
|
||||
// unquoteBytes should be an internal detail,
|
||||
// but widely used packages access it using linkname.
|
||||
// Notable members of the hall of shame include:
|
||||
// - github.com/bytedance/sonic
|
||||
//
|
||||
// Do not remove or change the type signature.
|
||||
// See go.dev/issue/67401.
|
||||
//
|
||||
//go:linkname unquoteBytes
|
||||
func unquoteBytes(s []byte) (t []byte, ok bool) {
|
||||
if len(s) < 2 || s[0] != '"' || s[len(s)-1] != '"' {
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue