Skip to content

Go 1.18 on MacOS: linkname must refer to declared function or variable

Go 1.18 on MacOS: linkname must refer to declared function or variable

Problem

../../gopath/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.go:75:3: 
//go:linkname must refer to declared function or variable
../../gopath/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.go:90:3: 
//go:linkname must refer to declared function or variable
../../gopath/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.go:105:3: 
//go:linkname must refer to declared function or variable
../../gopath/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.go:121:3: 
//go:linkname must refer to declared function or variable
../../gopath/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.go:121:3: 
too many errors

Compilation finished with exit code 2

Solution

go get -u golang.org/x/sys

Disclaimer
  1. License under CC BY-NC 4.0
  2. Copyright issue feedback me#imzye.me, replace # with @
  3. Not all the commands and scripts are tested in production environment, use at your own risk
  4. No privacy information is collected here
Try iOS App