我尝试运行以下 bar.go 脚本
package main
import (
"fmt"
"syscall"
)
func main() {
fmt.Printf("%d\n", uintptr(syscall.ENONET))
}
通过调用go run bar.go并得到这个错误:
# command-line-arguments
./bar.go:9:29: undefined: syscall.ENONET
我正在使用 Mac 和 go 版本1.14.3 darwin/amd64。我试图在 Go 操场上运行这个确切的脚本,https://play.golang.org/p/ecMZPsGgGOa并且它有效。
我尝试使用运行脚本CGO_ENABLED=1 GOOS=linux GOARCH=amd64并收到此错误:
fork/exec /var/folders/2l/dj6ph5t92y17vhtv3n6xzr5r0000gn/T/go-build847134732/b001/exe/bar: exec format error
如何syscall.ENONET在 Mac 上工作?
ibeautiful
相关分类