Go version
go version go1.26.4-X:nodwarf5 linux/amd64
Output of go env in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/gucio321/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/gucio321/.config/go/env'
GOEXE=''
GOEXPERIMENT='nodwarf5'
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2759617959=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/home/gucio321/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/gucio321/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/gucio321/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.26.4-X:nodwarf5'
GOWORK=''
PKG_CONFIG='pkg-config'
What did you do?
Hi!
I wa writing a simple code using os.ReadFile. I wanted to hanhdle os.ErrNotExist somehow. I spent around 5 min searching through documentation and go src code (ended up asking AI which finally gave me an answer).
What did you see happen?
go doc os.ReadFile doesn't mention what errors are returned by os.ReadFile.
What did you expect to see?
go doc os.open says If there is an error, it will be of type *PathError.. This is a minium I'd expect to hear from go doc os.ReadFile as well.
ReadFile reads the named file and returns the contents. A successful call
returns err == nil, not err == EOF. Because ReadFile reads the whole file,
it does not treat an EOF from Read as an error to be reported.
Open opens the named file for reading. If successful, methods on the
returned file can be used for reading; the associated file descriptor has
mode O_RDONLY. If there is an error, it will be of type *PathError.
Go version
go version go1.26.4-X:nodwarf5 linux/amd64
Output of
go envin your module/workspace:What did you do?
Hi!
I wa writing a simple code using
os.ReadFile. I wanted to hanhdleos.ErrNotExistsomehow. I spent around 5 min searching through documentation and go src code (ended up asking AI which finally gave me an answer).What did you see happen?
go doc os.ReadFiledoesn't mention what errors are returned byos.ReadFile.What did you expect to see?
go doc os.opensaysIf there is an error, it will be of type *PathError.. This is a minium I'd expect to hear fromgo doc os.ReadFileas well.