Unreviewed changes
1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: src/cmd/go/internal/modindex/build_read.go
Insertions: 2, Deletions: 2.
The diff is too large to show. Please review the diff.
```
```
The name of the file: src/go/build/read.go
Insertions: 2, Deletions: 2.
The diff is too large to show. Please review the diff.
```
Change information
Commit message:
go/build, cmd/go: use ast.ParseDirective for go:embed
Currently, "//go:embed" directives are read by bespoke parsers in
go/build and cmd/go/internal/modindex. Replace these bespoke parsers
with scanner.Scanner for finding these directives and
ast.ParseDirective for parsing them.
It's not clear why we had a bespoke parser just for finding
"//go:embed" directives in the first place. We have a bespoke parser
for reading imports in order to avoid having to read the entire source
file into memory, but if we're parsing embeds, we wind up reading the
entire source file into memory anyway. Using scanner.Scanner instead
eliminates some truly confusing code.
This also demonstrates that ast.ParseDirective as proposed in #68021
achieves useful API coverage.
Updates #68021.
Change-Id: Ieb68738121dcff605a6a704a8045ddd2ff35df35
Files:
- M src/cmd/go/internal/modindex/build_read.go
- M src/go/build/read.go
Change size: L
Delta: 2 files changed, 88 insertions(+), 474 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Code-Review: +2 by Alan Donovan
TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI