What version of Go are you using (go version)?
$ go version
go1.20
Does this issue reproduce with the latest release?
Yes, go1.20, go1.21, tip
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
[go playground]
What did you do?
package main
import (
"fmt"
"unsafe"
)
type M struct {
p string
}
var k = []*M{
{"a"}, {"b"}, {"c"},
}
//go:linkname x main.k
var x unsafe.Pointer
func main() {
fmt.Println(k)
fmt.Println(x)
}
Go playground link: https://go.dev/play/p/TzmdH78MJj-
What did you expect to see?
Address of k
What did you see instead?
./prog.go:14:5: <unknown line number>: symbol main.k redeclared
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes, go1.20, go1.21, tip
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
Go playground link: https://go.dev/play/p/TzmdH78MJj-
What did you expect to see?
Address of
kWhat did you see instead?
./prog.go:14:5: <unknown line number>: symbol main.k redeclared