Can not use x/sys/unix on Windows

I’m using windows 10 OS.
I can import ““golang.org/x/sys/unix”” package correctly.But when I tried to use the Constant that defined in the package,the error occured,like this:


And I did’t get any code hint while using this package.When I tried to use ““golang.org/x/sys/windows””,everything is ok.I
I’m so confused now.Is it related to operation 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:

The sys/unix packages are only available on Unixes, similarly the sys/windows packages are only available on windows.

Thanks! :+1:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.