Go build packaging Error:
TARGET_OS_MAC & IOMasterPort
#github.com/shirou/gopsutil/cpu
../../../../go/pkg/mod/github.com/shirou/[email protected]+incompatible/cpu/cpu_darwin_cgo.go:13:5:
warning: 'TARGET_OS_MAC' is not defined, evaluates to 0 [-Wundef-prefix=TARGET_OS_]
#github.com/shirou/gopsutil/disk
iostat_darwin.c:28:2:
warning: 'IOMasterPort' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:132:1:
note: 'IOMasterPort' has been explicitly marked deprecated here
I don’t know the cause of the problem at present. It may be caused by the upgrade of the MAC system
My version is MacOS Monterey 12.3
Solution (not necessarily effective)
Modify CGO_ENABLED,default is CGO_ENABLED="1"
go env -w CGO_ENABLED="0"