mirror of
https://github.com/golang/go
synced 2024-11-26 19:51:17 -07:00
go/build: skip rune literals when looking for go:embed
Fixes #49514 Change-Id: Id687eead731ba49974f11d2e5b489f11eff7d07b Reviewed-on: https://go-review.googlesource.com/c/go/+/363275 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
parent
eb68e3367b
commit
c622d1d3f6
@ -60,6 +60,11 @@ func testDir(t *testing.T, f embed.FS, name string, expect ...string) {
|
||||
}
|
||||
}
|
||||
|
||||
// Tests for issue 49514.
|
||||
var _ = '"'
|
||||
var _ = '\''
|
||||
var _ = '🦆'
|
||||
|
||||
func TestGlobal(t *testing.T) {
|
||||
testFiles(t, global, "concurrency.txt", "Concurrency is not parallelism.\n")
|
||||
testFiles(t, global, "testdata/hello.txt", "hello, world\n")
|
||||
|
@ -240,6 +240,27 @@ func (r *importReader) findEmbed(first bool) bool {
|
||||
}
|
||||
}
|
||||
|
||||
case '\'':
|
||||
startLine = false
|
||||
for r.err == nil {
|
||||
if r.eof {
|
||||
r.syntaxError()
|
||||
}
|
||||
c = r.readByteNoBuf()
|
||||
if c == '\\' {
|
||||
r.readByteNoBuf()
|
||||
if r.err != nil {
|
||||
r.syntaxError()
|
||||
return false
|
||||
}
|
||||
continue
|
||||
}
|
||||
if c == '\'' {
|
||||
c = r.readByteNoBuf()
|
||||
goto Reswitch
|
||||
}
|
||||
}
|
||||
|
||||
case '/':
|
||||
c = r.readByteNoBuf()
|
||||
switch c {
|
||||
|
Loading…
Reference in New Issue
Block a user