]> Cypherpunks repositories - gostls13.git/commit
go/parser: simplify code to read from an io.Reader (cleanup)
authorRobert Griesemer <gri@golang.org>
Sat, 23 Dec 2017 00:29:36 +0000 (16:29 -0800)
committerRobert Griesemer <gri@golang.org>
Mon, 12 Feb 2018 21:43:10 +0000 (21:43 +0000)
commit29461ccc7f7b6a73bc0104731cfbe0c2cbe86733
tree6630247f2bc9bbbf31f7d452f223d8424de7823b
parentea012d100bad48e5659637fde2f4d9737a087815
go/parser: simplify code to read from an io.Reader (cleanup)

ioutil.ReadAll didn't exist when we wrote that parser code
originally (in 2009). Now it does, so use it. This may also
make that code path slightly more efficient.

Also, now that we are guaranteed to have a fast path for reading
from an io.Reader (and thus an io.ReadCloser), simplify setup
code for parser.ParseFile calls in srcimporter.Importer.ParseFiles.

Remove the associated TODO since we cannot reproduce any significant
performance differences when running go test -run ImportStdLib for
the case where we used to read directly from a file (even before the
change to the parser).

Fixes #19281.

Change-Id: I816459d092bb9e27fdc85089b8f21d57ec3fd79a
Reviewed-on: https://go-review.googlesource.com/85395
Reviewed-by: Alan Donovan <adonovan@google.com>
src/go/build/deps_test.go
src/go/internal/srcimporter/srcimporter.go
src/go/parser/interface.go