Can’t access x/sys/unix on Windows – Getting Help

I am using windows 10 os.
I can import the package “golang.org/x/sys/unix” correctly. But when I tried to use the constants defined in the package, error occurred, like:

And I didn’t get any code prompts when using this package. When I tried to use “golang.org/x/sys/windows”, everything is fine. I
I am very confused now. Is it related to operating system?

Go Version:

go version go1.18.4 windows/amd64

Go Env:

set GO111MODULE=auto
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Administrator\AppData\Local\go-build
set GOENV=C:\Users\Administrator\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=D:\golangCode\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\golangCode
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=F:\golang
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=F:\golang\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.18.4
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\ADMINI~1\AppData\Local\Temp\go-build1632376270=/tmp/go-build -gno-record-gcc-switches

GOPATH package:


Leave a Comment