]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: add //go:embed support
authorRuss Cox <rsc@golang.org>
Sun, 19 Jul 2020 04:32:02 +0000 (00:32 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 23 Oct 2020 00:29:10 +0000 (00:29 +0000)
commit8bde9b320e25b2d6edf96fa5e694046fea0c04c8
treee279ac87b40f2bb560ecab337609d726534fb820
parent400581b8b008ece8d0df34f54f281d365a175dba
cmd/compile: add //go:embed support

This commit contains the compiler support for //go:embed lines.
The go command passes to the compiler an "embed config"
that maps literal patterns like *.txt to the set of files to embed.
The compiler then lays out the content of those files as static data
in the form of an embed.Files or string or []byte in the final object file.

The test for this code is the end-to-end test hooking up the
embed, cmd/compile, and cmd/go changes, in the next CL.

For #41191.

Change-Id: I916e57f8cc65871dc0044c13d3f90c252a3fe1bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/243944
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/gc/embed.go [new file with mode: 0644]
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/noder.go
src/cmd/compile/internal/gc/obj.go
src/cmd/compile/internal/gc/syntax.go
src/cmd/compile/internal/gc/typecheck.go
src/cmd/internal/obj/link.go
src/cmd/internal/obj/objfile.go