aboutsummaryrefslogtreecommitdiff
path: root/src/database/sql
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2024-05-22 23:06:30 -0400
committerGopher Robot <gobot@golang.org>2024-05-29 17:58:53 +0000
commit2a7ca156b8189c68c0a29b4c66194a42c5ce3c9b (patch)
tree7ac6dc198ebad85420719774562d29b7b59c6684 /src/database/sql
parent5121b45d7426687076c20ae0f4fcae1238f3ed47 (diff)
downloadgo-2a7ca156b8189c68c0a29b4c66194a42c5ce3c9b.tar.xz
all: document legacy //go:linkname for final round of modules
Add linknames for most modules with ≥50 dependents. Add linknames for a few other modules that we know are important but are below 50. Remove linknames from badlinkname.go that do not merit inclusion (very small number of dependents). We can add them back later if the need arises. Fixes #67401. (For now.) Change-Id: I1e49fec0292265256044d64b1841d366c4106002 Reviewed-on: https://go-review.googlesource.com/c/go/+/587756 Auto-Submit: Russ Cox <rsc@golang.org> TryBot-Bypass: Russ Cox <rsc@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/database/sql')
-rw-r--r--src/database/sql/badlinkname.go15
-rw-r--r--src/database/sql/convert.go11
2 files changed, 11 insertions, 15 deletions
diff --git a/src/database/sql/badlinkname.go b/src/database/sql/badlinkname.go
deleted file mode 100644
index 95a2354afd..0000000000
--- a/src/database/sql/badlinkname.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2024 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package sql
-
-import _ "unsafe"
-
-// As of Go 1.22, the symbols below are found to be pulled via
-// linkname in the wild. We provide a push linkname here, to
-// keep them accessible with pull linknames.
-// This may change in the future. Please do not depend on them
-// in new code.
-
-//go:linkname convertAssign
diff --git a/src/database/sql/convert.go b/src/database/sql/convert.go
index 8f71d5b867..c261046b18 100644
--- a/src/database/sql/convert.go
+++ b/src/database/sql/convert.go
@@ -16,6 +16,7 @@ import (
"time"
"unicode"
"unicode/utf8"
+ _ "unsafe" // for linkname
)
var errNilPtr = errors.New("destination pointer is nil") // embedded in descriptive error
@@ -207,6 +208,16 @@ func driverArgsConnLocked(ci driver.Conn, ds *driverStmt, args []any) ([]driver.
// convertAssign is the same as convertAssignRows, but without the optional
// rows argument.
+//
+// convertAssign should be an internal detail,
+// but widely used packages access it using linkname.
+// Notable members of the hall of shame include:
+// - ariga.io/entcache
+//
+// Do not remove or change the type signature.
+// See go.dev/issue/67401.
+//
+//go:linkname convertAssign
func convertAssign(dest, src any) error {
return convertAssignRows(dest, src, nil)
}