From 3dcdc09c85bb07be0bbef6d6acc9e0e2534205be Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 23 Jan 2024 14:42:42 -0500 Subject: [PATCH] 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui --- src/maps/maps.go | 5 +++++ src/maps/maps.s | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 src/maps/maps.s diff --git a/src/maps/maps.go b/src/maps/maps.go index befde18c9c..82b348c2f3 100644 --- a/src/maps/maps.go +++ b/src/maps/maps.go @@ -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: diff --git a/src/maps/maps.s b/src/maps/maps.s deleted file mode 100644 index 4e5577892d..0000000000 --- a/src/maps/maps.s +++ /dev/null @@ -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. \ No newline at end of file -- 2.48.1