Skip to content

Commit baa5c2d

Browse files
dolmengopherbot
authored andcommitted
all: add godoc links
Change-Id: Ic9532893740b9952ca429106b3c373cc14d0383e Reviewed-on: https://go-review.googlesource.com/c/mod/+/500875 Run-TryBot: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Oleksandr Redko <[email protected]> Auto-Submit: Bryan Mills <[email protected]>
1 parent 7603649 commit baa5c2d

File tree

17 files changed

+99
-97
lines changed

17 files changed

+99
-97
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ That is, it is for direct manipulation of Go modules themselves.
99
It is NOT about supporting general development tools that
1010
need to do things like load packages in module mode.
1111
That use case, where modules are incidental rather than the focus,
12-
should remain in x/tools, specifically x/tools/go/packages.
12+
should remain in [x/tools](https://pkg.go.dev/golang/org/x/tools),
13+
specifically [x/tools/go/packages](https://pkg.go.dev/golang.org/x/tools/go/packages).
1314

1415
The specific case of loading packages should still be done by
1516
invoking the go command, which remains the single point of

internal/lazyregexp/lazyre.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"sync"
1414
)
1515

16-
// Regexp is a wrapper around regexp.Regexp, where the underlying regexp will be
16+
// Regexp is a wrapper around [regexp.Regexp], where the underlying regexp will be
1717
// compiled the first time it is needed.
1818
type Regexp struct {
1919
str string

modfile/read.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ type Comments struct {
6565
}
6666

6767
// Comment returns the receiver. This isn't useful by itself, but
68-
// a Comments struct is embedded into all the expression
68+
// a [Comments] struct is embedded into all the expression
6969
// implementation types, and this gives each of those a Comment
7070
// method to satisfy the Expr interface.
7171
func (c *Comments) Comment() *Comments {

modfile/rule.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
// Package modfile implements a parser and formatter for go.mod files.
66
//
77
// The go.mod syntax is described in
8-
// https://golang.org/cmd/go/#hdr-The_go_mod_file.
8+
// https://pkg.go.dev/cmd/go/#hdr-The_go_mod_file.
99
//
10-
// The Parse and ParseLax functions both parse a go.mod file and return an
10+
// The [Parse] and [ParseLax] functions both parse a go.mod file and return an
1111
// abstract syntax tree. ParseLax ignores unknown statements and may be used to
1212
// parse go.mod files that may have been developed with newer versions of Go.
1313
//
14-
// The File struct returned by Parse and ParseLax represent an abstract
15-
// go.mod file. File has several methods like AddNewRequire and DropReplace
16-
// that can be used to programmatically edit a file.
14+
// The [File] struct returned by Parse and ParseLax represent an abstract
15+
// go.mod file. File has several methods like [File.AddNewRequire] and
16+
// [File.DropReplace] that can be used to programmatically edit a file.
1717
//
18-
// The Format function formats a File back to a byte slice which can be
18+
// The [Format] function formats a File back to a byte slice which can be
1919
// written to a file.
2020
package modfile
2121

@@ -226,7 +226,7 @@ var dontFixRetract VersionFixer = func(_, vers string) (string, error) {
226226
// data is the content of the file.
227227
//
228228
// fix is an optional function that canonicalizes module versions.
229-
// If fix is nil, all module versions must be canonical (module.CanonicalVersion
229+
// If fix is nil, all module versions must be canonical ([module.CanonicalVersion]
230230
// must return the same string).
231231
func Parse(file string, data []byte, fix VersionFixer) (*File, error) {
232232
return parseToFile(file, data, fix, true)
@@ -923,7 +923,7 @@ func (f *File) Format() ([]byte, error) {
923923
}
924924

925925
// Cleanup cleans up the file f after any edit operations.
926-
// To avoid quadratic behavior, modifications like DropRequire
926+
// To avoid quadratic behavior, modifications like [File.DropRequire]
927927
// clear the entry but do not remove it from the slice.
928928
// Cleanup cleans out all the cleared entries.
929929
func (f *File) Cleanup() {
@@ -1075,8 +1075,8 @@ func (f *File) AddNewRequire(path, vers string, indirect bool) {
10751075
// The requirements in req must specify at most one distinct version for each
10761076
// module path.
10771077
//
1078-
// If any existing requirements may be removed, the caller should call Cleanup
1079-
// after all edits are complete.
1078+
// If any existing requirements may be removed, the caller should call
1079+
// [File.Cleanup] after all edits are complete.
10801080
func (f *File) SetRequire(req []*Require) {
10811081
type elem struct {
10821082
version string

modfile/work.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type Use struct {
3434
// data is the content of the file.
3535
//
3636
// fix is an optional function that canonicalizes module versions.
37-
// If fix is nil, all module versions must be canonical (module.CanonicalVersion
37+
// If fix is nil, all module versions must be canonical ([module.CanonicalVersion]
3838
// must return the same string).
3939
func ParseWork(file string, data []byte, fix VersionFixer) (*WorkFile, error) {
4040
fs, err := parse(file, data)
@@ -83,7 +83,7 @@ func ParseWork(file string, data []byte, fix VersionFixer) (*WorkFile, error) {
8383
}
8484

8585
// Cleanup cleans up the file f after any edit operations.
86-
// To avoid quadratic behavior, modifications like DropRequire
86+
// To avoid quadratic behavior, modifications like [WorkFile.DropRequire]
8787
// clear the entry but do not remove it from the slice.
8888
// Cleanup cleans out all the cleared entries.
8989
func (f *WorkFile) Cleanup() {

module/module.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
// Package module defines the module.Version type along with support code.
66
//
7-
// The module.Version type is a simple Path, Version pair:
7+
// The [module.Version] type is a simple Path, Version pair:
88
//
99
// type Version struct {
1010
// Path string
1111
// Version string
1212
// }
1313
//
1414
// There are no restrictions imposed directly by use of this structure,
15-
// but additional checking functions, most notably Check, verify that
15+
// but additional checking functions, most notably [Check], verify that
1616
// a particular path, version pair is valid.
1717
//
1818
// # Escaped Paths
@@ -140,7 +140,7 @@ type ModuleError struct {
140140
Err error
141141
}
142142

143-
// VersionError returns a ModuleError derived from a Version and error,
143+
// VersionError returns a [ModuleError] derived from a [Version] and error,
144144
// or err itself if it is already such an error.
145145
func VersionError(v Version, err error) error {
146146
var mErr *ModuleError
@@ -169,7 +169,7 @@ func (e *ModuleError) Unwrap() error { return e.Err }
169169
// An InvalidVersionError indicates an error specific to a version, with the
170170
// module path unknown or specified externally.
171171
//
172-
// A ModuleError may wrap an InvalidVersionError, but an InvalidVersionError
172+
// A [ModuleError] may wrap an InvalidVersionError, but an InvalidVersionError
173173
// must not wrap a ModuleError.
174174
type InvalidVersionError struct {
175175
Version string
@@ -193,8 +193,8 @@ func (e *InvalidVersionError) Error() string {
193193
func (e *InvalidVersionError) Unwrap() error { return e.Err }
194194

195195
// An InvalidPathError indicates a module, import, or file path doesn't
196-
// satisfy all naming constraints. See CheckPath, CheckImportPath,
197-
// and CheckFilePath for specific restrictions.
196+
// satisfy all naming constraints. See [CheckPath], [CheckImportPath],
197+
// and [CheckFilePath] for specific restrictions.
198198
type InvalidPathError struct {
199199
Kind string // "module", "import", or "file"
200200
Path string
@@ -294,7 +294,7 @@ func fileNameOK(r rune) bool {
294294
}
295295

296296
// CheckPath checks that a module path is valid.
297-
// A valid module path is a valid import path, as checked by CheckImportPath,
297+
// A valid module path is a valid import path, as checked by [CheckImportPath],
298298
// with three additional constraints.
299299
// First, the leading path element (up to the first slash, if any),
300300
// by convention a domain name, must contain only lower-case ASCII letters,
@@ -380,7 +380,7 @@ const (
380380
// checkPath returns an error describing why the path is not valid.
381381
// Because these checks apply to module, import, and file paths,
382382
// and because other checks may be applied, the caller is expected to wrap
383-
// this error with InvalidPathError.
383+
// this error with [InvalidPathError].
384384
func checkPath(path string, kind pathKind) error {
385385
if !utf8.ValidString(path) {
386386
return fmt.Errorf("invalid UTF-8")
@@ -532,7 +532,7 @@ var badWindowsNames = []string{
532532
// they require ".vN" instead of "/vN", and for all N, not just N >= 2.
533533
// SplitPathVersion returns with ok = false when presented with
534534
// a path whose last path element does not satisfy the constraints
535-
// applied by CheckPath, such as "example.com/pkg/v1" or "example.com/pkg/v1.2".
535+
// applied by [CheckPath], such as "example.com/pkg/v1" or "example.com/pkg/v1.2".
536536
func SplitPathVersion(path string) (prefix, pathMajor string, ok bool) {
537537
if strings.HasPrefix(path, "gopkg.in/") {
538538
return splitGopkgIn(path)
@@ -582,7 +582,7 @@ func splitGopkgIn(path string) (prefix, pathMajor string, ok bool) {
582582
// MatchPathMajor reports whether the semantic version v
583583
// matches the path major version pathMajor.
584584
//
585-
// MatchPathMajor returns true if and only if CheckPathMajor returns nil.
585+
// MatchPathMajor returns true if and only if [CheckPathMajor] returns nil.
586586
func MatchPathMajor(v, pathMajor string) bool {
587587
return CheckPathMajor(v, pathMajor) == nil
588588
}
@@ -622,7 +622,7 @@ func CheckPathMajor(v, pathMajor string) error {
622622
// PathMajorPrefix returns the major-version tag prefix implied by pathMajor.
623623
// An empty PathMajorPrefix allows either v0 or v1.
624624
//
625-
// Note that MatchPathMajor may accept some versions that do not actually begin
625+
// Note that [MatchPathMajor] may accept some versions that do not actually begin
626626
// with this prefix: namely, it accepts a 'v0.0.0-' prefix for a '.v1'
627627
// pathMajor, even though that pathMajor implies 'v1' tagging.
628628
func PathMajorPrefix(pathMajor string) string {
@@ -643,7 +643,7 @@ func PathMajorPrefix(pathMajor string) string {
643643
}
644644

645645
// CanonicalVersion returns the canonical form of the version string v.
646-
// It is the same as semver.Canonical(v) except that it preserves the special build suffix "+incompatible".
646+
// It is the same as [semver.Canonical] except that it preserves the special build suffix "+incompatible".
647647
func CanonicalVersion(v string) string {
648648
cv := semver.Canonical(v)
649649
if semver.Build(v) == "+incompatible" {
@@ -652,8 +652,8 @@ func CanonicalVersion(v string) string {
652652
return cv
653653
}
654654

655-
// Sort sorts the list by Path, breaking ties by comparing Version fields.
656-
// The Version fields are interpreted as semantic versions (using semver.Compare)
655+
// Sort sorts the list by Path, breaking ties by comparing [Version] fields.
656+
// The Version fields are interpreted as semantic versions (using [semver.Compare])
657657
// optionally followed by a tie-breaking suffix introduced by a slash character,
658658
// like in "v0.0.1/go.mod".
659659
func Sort(list []Version) {
@@ -793,7 +793,7 @@ func unescapeString(escaped string) (string, bool) {
793793
}
794794

795795
// MatchPrefixPatterns reports whether any path prefix of target matches one of
796-
// the glob patterns (as defined by path.Match) in the comma-separated globs
796+
// the glob patterns (as defined by [path.Match]) in the comma-separated globs
797797
// list. This implements the algorithm used when matching a module path to the
798798
// GOPRIVATE environment variable, as described by 'go help module-private'.
799799
//

module/pseudo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func IsPseudoVersion(v string) bool {
125125
}
126126

127127
// IsZeroPseudoVersion returns whether v is a pseudo-version with a zero base,
128-
// timestamp, and revision, as returned by ZeroPseudoVersion.
128+
// timestamp, and revision, as returned by [ZeroPseudoVersion].
129129
func IsZeroPseudoVersion(v string) bool {
130130
return v == ZeroPseudoVersion(semver.Major(v))
131131
}

semver/semver.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func Compare(v, w string) int {
140140
// Max canonicalizes its arguments and then returns the version string
141141
// that compares greater.
142142
//
143-
// Deprecated: use Compare instead. In most cases, returning a canonicalized
143+
// Deprecated: use [Compare] instead. In most cases, returning a canonicalized
144144
// version is not expected or desired.
145145
func Max(v, w string) string {
146146
v = Canonical(v)
@@ -151,7 +151,7 @@ func Max(v, w string) string {
151151
return w
152152
}
153153

154-
// ByVersion implements sort.Interface for sorting semantic version strings.
154+
// ByVersion implements [sort.Interface] for sorting semantic version strings.
155155
type ByVersion []string
156156

157157
func (vs ByVersion) Len() int { return len(vs) }
@@ -164,7 +164,7 @@ func (vs ByVersion) Less(i, j int) bool {
164164
return vs[i] < vs[j]
165165
}
166166

167-
// Sort sorts a list of semantic version strings using ByVersion.
167+
// Sort sorts a list of semantic version strings using [ByVersion].
168168
func Sort(list []string) {
169169
sort.Sort(ByVersion(list))
170170
}

sumdb/client.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
)
2020

2121
// A ClientOps provides the external operations
22-
// (file caching, HTTP fetches, and so on) needed by the Client.
22+
// (file caching, HTTP fetches, and so on) needed by the [Client].
2323
// The methods must be safe for concurrent use by multiple goroutines.
2424
type ClientOps interface {
2525
// ReadRemote reads and returns the content served at the given path
@@ -72,7 +72,7 @@ type ClientOps interface {
7272
// ErrWriteConflict signals a write conflict during Client.WriteConfig.
7373
var ErrWriteConflict = errors.New("write conflict")
7474

75-
// ErrSecurity is returned by Client operations that invoke Client.SecurityError.
75+
// ErrSecurity is returned by [Client] operations that invoke Client.SecurityError.
7676
var ErrSecurity = errors.New("security error: misbehaving server")
7777

7878
// A Client is a client connection to a checksum database.
@@ -102,7 +102,7 @@ type Client struct {
102102
tileSaved map[tlog.Tile]bool // which tiles have been saved using c.ops.WriteCache already
103103
}
104104

105-
// NewClient returns a new Client using the given Client.
105+
// NewClient returns a new [Client] using the given [ClientOps].
106106
func NewClient(ops ClientOps) *Client {
107107
return &Client{
108108
ops: ops,
@@ -155,7 +155,7 @@ func (c *Client) initWork() {
155155
}
156156

157157
// SetTileHeight sets the tile height for the Client.
158-
// Any call to SetTileHeight must happen before the first call to Lookup.
158+
// Any call to SetTileHeight must happen before the first call to [Client.Lookup].
159159
// If SetTileHeight is not called, the Client defaults to tile height 8.
160160
// SetTileHeight can be called at most once,
161161
// and if so it must be called before the first call to Lookup.
@@ -174,7 +174,7 @@ func (c *Client) SetTileHeight(height int) {
174174

175175
// SetGONOSUMDB sets the list of comma-separated GONOSUMDB patterns for the Client.
176176
// For any module path matching one of the patterns,
177-
// Lookup will return ErrGONOSUMDB.
177+
// [Client.Lookup] will return ErrGONOSUMDB.
178178
// SetGONOSUMDB can be called at most once,
179179
// and if so it must be called before the first call to Lookup.
180180
func (c *Client) SetGONOSUMDB(list string) {
@@ -187,8 +187,8 @@ func (c *Client) SetGONOSUMDB(list string) {
187187
c.nosumdb = list
188188
}
189189

190-
// ErrGONOSUMDB is returned by Lookup for paths that match
191-
// a pattern listed in the GONOSUMDB list (set by SetGONOSUMDB,
190+
// ErrGONOSUMDB is returned by [Client.Lookup] for paths that match
191+
// a pattern listed in the GONOSUMDB list (set by [Client.SetGONOSUMDB],
192192
// usually from the environment variable).
193193
var ErrGONOSUMDB = errors.New("skipped (listed in GONOSUMDB)")
194194

0 commit comments

Comments
 (0)