aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcui fliter <imcusg@gmail.com>2023-10-13 14:53:49 +0800
committerGopher Robot <gobot@golang.org>2023-10-18 19:37:19 +0000
commit166063510aeb3bf94f4530aa9ce92ef1a15bb8dd (patch)
tree7fb50420c722aaab512f34c71d3cbeeb642b2999 /src
parent5d0a277fac610d55f73a970334987bfb686f9d80 (diff)
downloadgo-166063510aeb3bf94f4530aa9ce92ef1a15bb8dd.tar.xz
embed: add available godoc link
Change-Id: Iefccc7aeb0f697c555ae8a6a6bb6cd5091882195 Reviewed-on: https://go-review.googlesource.com/c/go/+/535079 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: shuang cui <imcusg@gmail.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/embed/embed.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/embed/embed.go b/src/embed/embed.go
index 8d155ebd55..b7bb16099e 100644
--- a/src/embed/embed.go
+++ b/src/embed/embed.go
@@ -5,7 +5,7 @@
// Package embed provides access to files embedded in the running Go program.
//
// Go source files that import "embed" can use the //go:embed directive
-// to initialize a variable of type string, []byte, or FS with the contents of
+// to initialize a variable of type string, []byte, or [FS] with the contents of
// files read from the package directory or subdirectories at compile time.
//
// For example, here are three ways to embed a file named hello.txt
@@ -45,7 +45,7 @@
// Only blank lines and ‘//’ line comments are permitted between the directive and the declaration.
//
// The type of the variable must be a string type, or a slice of a byte type,
-// or FS (or an alias of FS).
+// or [FS] (or an alias of [FS]).
//
// For example:
//
@@ -104,16 +104,16 @@
// the contents of that file.
//
// The //go:embed directive requires importing "embed", even when using a string or []byte.
-// In source files that don't refer to embed.FS, use a blank import (import _ "embed").
+// In source files that don't refer to [embed.FS], use a blank import (import _ "embed").
//
// # File Systems
//
// For embedding a single file, a variable of type string or []byte is often best.
-// The FS type enables embedding a tree of files, such as a directory of static
+// The [FS] type enables embedding a tree of files, such as a directory of static
// web server content, as in the example above.
//
-// FS implements the io/fs package's FS interface, so it can be used with any package that
-// understands file systems, including net/http, text/template, and html/template.
+// FS implements the [io/fs] package's [FS] interface, so it can be used with any package that
+// understands file systems, including [net/http], [text/template], and [html/template].
//
// For example, given the content variable in the example above, we can write:
//
@@ -299,9 +299,9 @@ func (f FS) readDir(dir string) []file {
return files[i:j]
}
-// Open opens the named file for reading and returns it as an fs.File.
+// Open opens the named file for reading and returns it as an [fs.File].
//
-// The returned file implements io.Seeker and io.ReaderAt when the file is not a directory.
+// The returned file implements [io.Seeker] and [io.ReaderAt] when the file is not a directory.
func (f FS) Open(name string) (fs.File, error) {
file := f.lookup(name)
if file == nil {