Skip to content

bufio: potentially unnecessary "continue" in bufio/scan.go #15712

@roylee0704

Description

@roylee0704

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go1.6.2 darwin/amd64
  2. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/roylee/dev/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.6.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.6.2/libexec/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
  1. What did you do?

bug: bufio/scan/scan.go, line 202.

It is not necessarily to continue, as in the next iteration, none of the codes earlier needs to be touched. It creates unnecessarily overheads to run splitFunc without filling up data from reader, first.

I have ran scan_test.go without continue, to my surprise, they are all passed! At the very least, if it belongs there, they should add a test case that shows it. I'm generally of the opinion that if small-but-severe changes to the code don't cause tests to fail, the tests are incomplete.

In my opinion, removing a continue definitely qualifies.

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
4. What did you expect to see?
5. What did you see instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions