maps: correct use of linkname

Linkname should have uses at both ends,
and then no fake assembly file is needed.

Change-Id: Ia2066be7b1e08d71a6db622d2a167f1b09cb7d9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/558297
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
Russ Cox 2024-01-23 14:42:42 -05:00
parent 09ed9a6585
commit 3dcdc09c85
2 changed files with 5 additions and 5 deletions

View File

@ -5,6 +5,10 @@
// Package maps defines various functions useful with maps of any type.
package maps
import (
_ "unsafe"
)
// Equal reports whether two maps contain the same key/value pairs.
// Values are compared using ==.
func Equal[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool {
@ -34,6 +38,7 @@ func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M
}
// clone is implemented in the runtime package.
//go:linkname clone maps.clone
func clone(m any) any
// Clone returns a copy of m. This is a shallow clone:

View File

@ -1,5 +0,0 @@
// Copyright 2023 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.
// need this empty asm file to enable linkname.