Skip to content

Commit

Permalink
all: add a few links in package godocs
Browse files Browse the repository at this point in the history
I noticed the one in path/filepath while reading the docs,
and the other ones were found via some quick grepping.

Change-Id: I386f2f74ef816a6d18aa2f58ee6b64dbd0147c9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/478795
Run-TryBot: Daniel Martí <[email protected]>
Reviewed-by: Heschi Kreinick <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
mvdan committed Mar 25, 2023
1 parent 478b1d2 commit 9768f73
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/bytes/bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.

// Package bytes implements functions for the manipulation of byte slices.
// It is analogous to the facilities of the strings package.
// It is analogous to the facilities of the [strings] package.
package bytes

import (
Expand Down
6 changes: 3 additions & 3 deletions src/crypto/elliptic/elliptic.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
// Package elliptic implements the standard NIST P-224, P-256, P-384, and P-521
// elliptic curves over prime fields.
//
// Direct use of this package is deprecated, beyond the P224(), P256(), P384(),
// and P521() values necessary to use the crypto/ecdsa package. Most other uses
// should migrate to the more efficient and safer crypto/ecdh package, or to
// Direct use of this package is deprecated, beyond the [P224], [P256], [P384],
// and [P521] values necessary to use [crypto/ecdsa]. Most other uses
// should migrate to the more efficient and safer [crypto/ecdh], or to
// third-party modules for lower-level functionality.
package elliptic

Expand Down
2 changes: 1 addition & 1 deletion src/encoding/gob/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Package gob manages streams of gobs - binary values exchanged between an
Encoder (transmitter) and a Decoder (receiver). A typical use is transporting
arguments and results of remote procedure calls (RPCs) such as those provided by
package "net/rpc".
[net/rpc].
The implementation compiles a custom codec for each data type in the stream and
is most efficient when a single Encoder is used to transmit a stream of values,
Expand Down
8 changes: 4 additions & 4 deletions src/html/template/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
/*
Package template (html/template) implements data-driven templates for
generating HTML output safe against code injection. It provides the
same interface as package text/template and should be used instead of
text/template whenever the output is HTML.
same interface as [text/template] and should be used instead of
[text/template] whenever the output is HTML.
The documentation here focuses on the security features of the package.
For information about how to program the templates themselves, see the
documentation for text/template.
documentation for [text/template].
# Introduction
This package wraps package text/template so you can share its template API
This package wraps [text/template] so you can share its template API
to parse and execute HTML templates safely.
tmpl, err := template.New("name").Parse(...)
Expand Down
5 changes: 2 additions & 3 deletions src/math/big/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ the Stringer interface for a (default) string representation of the value,
but also provide SetString methods to initialize a value from a string in
a variety of supported formats (see the respective SetString documentation).
Finally, *Int, *Rat, and *Float satisfy the fmt package's Scanner interface
for scanning and (except for *Rat) the Formatter interface for formatted
printing.
Finally, *Int, *Rat, and *Float satisfy [fmt.Scanner] for scanning
and (except for *Rat) the Formatter interface for formatted printing.
*/
package big
13 changes: 6 additions & 7 deletions src/net/netip/netip.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
// license that can be found in the LICENSE file.

// Package netip defines an IP address type that's a small value type.
// Building on that Addr type, the package also defines AddrPort (an
// IP address and a port), and Prefix (an IP address and a bit length
// Building on that [Addr] type, the package also defines [AddrPort] (an
// IP address and a port) and [Prefix] (an IP address and a bit length
// prefix).
//
// Compared to the net.IP type, this package's Addr type takes less
// memory, is immutable, and is comparable (supports == and being a
// map key).
// Compared to the [net.IP] type, [Addr] type takes less memory, is immutable,
// and is comparable (supports == and being a map key).
package netip

import (
Expand All @@ -28,9 +27,9 @@ import (
// netip.Addr: 24 bytes (zone is per-name singleton, shared across all users)

// Addr represents an IPv4 or IPv6 address (with or without a scoped
// addressing zone), similar to net.IP or net.IPAddr.
// addressing zone), similar to [net.IP] or [net.IPAddr].
//
// Unlike net.IP or net.IPAddr, Addr is a comparable value
// Unlike [net.IP] or [net.IPAddr], Addr is a comparable value
// type (it supports == and can be a map key) and is immutable.
//
// The zero Addr is not a valid IP address.
Expand Down
8 changes: 4 additions & 4 deletions src/os/signal/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ therefore cannot be affected by this package.
Synchronous signals are signals triggered by errors in program
execution: SIGBUS, SIGFPE, and SIGSEGV. These are only considered
synchronous when caused by program execution, not when sent using
os.Process.Kill or the kill program or some similar mechanism. In
[os.Process.Kill] or the kill program or some similar mechanism. In
general, except as discussed below, Go programs will convert a
synchronous signal into a run-time panic.
Expand Down Expand Up @@ -52,7 +52,7 @@ generally be honored. However, some signals are explicitly unblocked:
the synchronous signals, SIGILL, SIGTRAP, SIGSTKFLT, SIGCHLD, SIGPROF,
and, on Linux, signals 32 (SIGCANCEL) and 33 (SIGSETXID)
(SIGCANCEL and SIGSETXID are used internally by glibc). Subprocesses
started by os.Exec, or by the os/exec package, will inherit the
started by [os.Exec], or by [os/exec], will inherit the
modified signal mask.
# Changing the behavior of signals in Go programs
Expand Down Expand Up @@ -210,8 +210,8 @@ before raising the signal.
# Windows
On Windows a ^C (Control-C) or ^BREAK (Control-Break) normally cause
the program to exit. If Notify is called for os.Interrupt, ^C or ^BREAK
will cause os.Interrupt to be sent on the channel, and the program will
the program to exit. If Notify is called for [os.Interrupt], ^C or ^BREAK
will cause [os.Interrupt] to be sent on the channel, and the program will
not exit. If Reset is called, or Stop is called on all channels passed
to Notify, then the default behavior will be restored.
Expand Down
2 changes: 1 addition & 1 deletion src/path/filepath/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// The filepath package uses either forward slashes or backslashes,
// depending on the operating system. To process paths such as URLs
// that always use forward slashes regardless of the operating
// system, see the path package.
// system, see the [path] package.
package filepath

import (
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/metrics/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/*
Package metrics provides a stable interface to access implementation-defined
metrics exported by the Go runtime. This package is similar to existing functions
like runtime.ReadMemStats and debug.ReadGCStats, but significantly more general.
like [runtime.ReadMemStats] and [debug.ReadGCStats], but significantly more general.
The set of metrics defined by this package may evolve as the runtime itself
evolves, and also enables variation across Go implementations, whose relevant
Expand Down
12 changes: 6 additions & 6 deletions src/strconv/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//
// These assume decimal and the Go int type.
//
// ParseBool, ParseFloat, ParseInt, and ParseUint convert strings to values:
// [ParseBool], [ParseFloat], [ParseInt], and [ParseUint] convert strings to values:
//
// b, err := strconv.ParseBool("true")
// f, err := strconv.ParseFloat("3.1415", 64)
Expand All @@ -30,27 +30,27 @@
// ...
// i := int32(i64)
//
// FormatBool, FormatFloat, FormatInt, and FormatUint convert values to strings:
// [FormatBool], [FormatFloat], [FormatInt], and [FormatUint] convert values to strings:
//
// s := strconv.FormatBool(true)
// s := strconv.FormatFloat(3.1415, 'E', -1, 64)
// s := strconv.FormatInt(-42, 16)
// s := strconv.FormatUint(42, 16)
//
// AppendBool, AppendFloat, AppendInt, and AppendUint are similar but
// [AppendBool], [AppendFloat], [AppendInt], and [AppendUint] are similar but
// append the formatted value to a destination slice.
//
// # String Conversions
//
// Quote and QuoteToASCII convert strings to quoted Go string literals.
// [Quote] and [QuoteToASCII] convert strings to quoted Go string literals.
// The latter guarantees that the result is an ASCII string, by escaping
// any non-ASCII Unicode with \u:
//
// q := strconv.Quote("Hello, 世界")
// q := strconv.QuoteToASCII("Hello, 世界")
//
// QuoteRune and QuoteRuneToASCII are similar but accept runes and
// [QuoteRune] and [QuoteRuneToASCII] are similar but accept runes and
// return quoted Go rune literals.
//
// Unquote and UnquoteChar unquote Go string and rune literals.
// [Unquote] and [UnquoteChar] unquote Go string and rune literals.
package strconv
2 changes: 1 addition & 1 deletion src/sync/atomic/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//
// These functions require great care to be used correctly.
// Except for special, low-level applications, synchronization is better
// done with channels or the facilities of the sync package.
// done with channels or the facilities of the [sync] package.
// Share memory by communicating;
// don't communicate by sharing memory.
//
Expand Down
2 changes: 1 addition & 1 deletion src/text/template/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/*
Package template implements data-driven templates for generating textual output.
To generate HTML output, see package html/template, which has the same interface
To generate HTML output, see [html/template], which has the same interface
as this package but automatically secures HTML output against certain attacks.
Templates are executed by applying them to a data structure. Annotations in the
Expand Down

0 comments on commit 9768f73

Please sign in to comment.