Source file test/linkname3.go
1 // errorcheck 2 3 // Copyright 2020 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 // Tests that errors are reported for misuse of linkname. 8 package p 9 10 import _ "unsafe" 11 12 type t int 13 14 var x, y int 15 16 //go:linkname x ok 17 18 // ERROR "//go:linkname must refer to declared function or variable" 19 // ERROR "//go:linkname must refer to declared function or variable" 20 // ERROR "duplicate //go:linkname for x" 21 22 //line linkname3.go:18 23 //go:linkname nonexist nonexist 24 //go:linkname t notvarfunc 25 //go:linkname x duplicate 26