From: Russ Cox
Module-aware mode is enabled by default, regardless of whether a
go.mod
file is present in the current working directory or a
- parent directory. Specifically, the GO111MODULE
environment
+ parent directory. More precisely, the GO111MODULE
environment
variable now defaults to on
. To switch to the previous behavior,
set GO111MODULE
to auto
.
+ The go
command now supports including
+ static files and file trees as part of the final executable,
+ using the new //go:embed
directive.
+ See the documentation for the new
+ embed
+ package for details.
+
go
test
@@ -260,7 +271,15 @@ Do not send CLs removing the interior tags from such phrases.
- TODO
+ The new runtime/metrics
package
+ introduces a stable interface for reading
+ implementation-defined metrics from the Go runtime.
+ It supersedes existing functions like
+ runtime.ReadMemStats
+ and
+ debug.GCStats
+ and is significantly more general and efficient.
+ See the package documentation for more details.
@@ -313,9 +332,54 @@ Do not send CLs removing the interior tags from such phrases.
+ The new embed
package
+ provides access to files embedded in the program during compilation
+ using the new //go:embed
directive.
+
+ The new io/fs
package
+ defines an abstraction for read-only trees of files,
+ the fs.FS
interface,
+ and the standard library packages have
+ been adapted to make use of the interface as appropriate.
+
+ On the producer side of the interface,
+ the new embed.FS type
+ implements fs.FS
, as does
+ zip.Reader
.
+ The new os.Dir
function
+ provides an implementation of fs.FS
backed by a tree
+ of operating system files.
+
+ On the consumer side,
+ the new http.FS
+ function converts an fs.FS
to an
+ http.Handler
.
+ Also, the html/template
+ and text/template
+ packagesâ ParseFS
+ functions and methods read templates from an fs.FS
.
+
- TODO: mention significant additions like new packages (io/fs
),
- new proposal-scoped features (//go:embed
), and so on
+ For testing code that implements fs.FS
,
+ the new testing/fstest
+ package provides a TestFS
+ function that checks for and reports common mistakes.
+ It also provides a simple in-memory file system implementation,
+ MapFS
,
+ which can be useful for testing code that accepts fs.FS
+ implementations.