You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
yes.
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\lenni\AppData\Local\go-build
set GOENV=C:\Users\lenni\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\lenni\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\lenni\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Users\lenni\scoop\apps\go\current
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Users\lenni\scoop\apps\go\current\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.16.6
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\tmp\drive\go.mod
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 -fmessage-length=0 -fdebug-prefix-map=C:\Users\lenni\AppData\Local\Temp\go-build1962934238=/tmp/go-build -gno-record-gcc-switches
What did you do?
I'm trying to get the disk usage under Windows using Go. This is my code:
The functions in x/sys/windows are all the W variants (UTF-16), not the A variants (ASCII).
This line:
ptr:= (*uint16)(unsafe.Pointer(&p))
forcibly casts a pointer to a Go string header (a struct containing a pointer and length) to a *uint16, but that does not encode the string. (A Go *string is not a C LPCWSTR.)
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I'm trying to get the disk usage under Windows using Go. This is my code:
For this to work, the folder C:\tmp\ must exist and be user-readable.
What did you expect to see?
I expected some output along the lines of
because that's how much free space I have on my C: drive.
What did you see instead?
The same program but in C works:
(note: the C program would fail if the folder is specified without a trailing path separator)
Thanks in advance.
The text was updated successfully, but these errors were encountered: