From: Russ Cox Date: Thu, 3 Dec 2020 15:31:42 +0000 (-0500) Subject: doc/go1.16: document embed, io/fs, runtime/metrics X-Git-Tag: go1.16beta1~103 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=932733d4212a7aa651f5060dff489f0819d928bb;p=gostls13.git doc/go1.16: document embed, io/fs, runtime/metrics Fixes #42915. Change-Id: Ia6e205aaac3cbf4ba7340deafad444ac3e573559 Reviewed-on: https://go-review.googlesource.com/c/go/+/275114 Trust: Russ Cox Run-TryBot: Russ Cox Reviewed-by: Ian Lance Taylor --- diff --git a/doc/go1.16.html b/doc/go1.16.html index 1862808486..88feab30c5 100644 --- a/doc/go1.16.html +++ b/doc/go1.16.html @@ -85,7 +85,7 @@ Do not send CLs removing the interior tags from such phrases.

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.

@@ -141,6 +141,17 @@ Do not send CLs removing the interior tags from such phrases. non-reproducible builds.

+

Embedding Files

+ +

+ 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.

Runtime

- 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.

Core library

+

Embedded Files

+ +

+ The new embed package + provides access to files embedded in the program during compilation + using the new //go:embed directive. +

+ +

File Systems

+ +

+ 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.