Go 1.18 build error //go:linkname must refer to declared function or variable
After upgrading to Go 1.18 version, you might get //go:linkname must refer to declared function or variable
error while running go build
command.
This error observed in Mac systems.
This is because of an older version of golang.org/x/sys
package.
To fix this //go:linkname must refer to declared function or variable
error we need to update x/sys
package by running below command.
go get -u golang.org/x/sys