Skip to content

bufio: document initialization requirements/usability of zero value #37347

Closed
@aka-rider

Description

@aka-rider

What version of Go are you using (go version)?

go version go1.13.8 darwin/amd64

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
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/rider/Library/Caches/go-build"
GOENV="/Users/rider/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY="gitlab.com/aigent/*"
GONOSUMDB="gitlab.com/aigent/*"
GOOS="darwin"
GOPATH="/Users/rider/wrk/go"
GOPRIVATE="gitlab.com/aigent/*"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.13.8/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.8/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/rider/wrk/go/src/github.com/aka-rider/nanoq/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/l8/_c7mlptn4zgbjb_xywymh2lm0000gn/T/go-build933390803=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

  • create bufio.Reader
  • call Reset
  • try to read

https://play.golang.org/p/eCVyld7ImE3

What did you expect to see?

bufio.Reader does not panic on attempt to read

What did you see instead?

bufio.Reader panics on any attempt to read (fill the buffer from the underlying reader)

panic: bufio: tried to fill full buffer

goroutine 1 [running]:
bufio.(*Reader).fill(0x41a764, 0x4404d0)
	/usr/local/go/src/bufio/bufio.go:95 +0x2c0
bufio.(*Reader).ReadByte(0x41a764, 0xae9e0, 0x43e0a0, 0x9, 0x40c0c0, 0x432000)
	/usr/local/go/src/bufio/bufio.go:252 +0x40
main.main()
	/tmp/sandbox711084966/prog.go:12 +0x160

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions