this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

all: fix a number of bad godocs spotted by gopls

Mostly typos of the declared name, sentences which mentioned the name
later on rather than at the beginning, as well as some comments
which did not intend to be a godoc at all.

While here, we tweak a few to use links too.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I0ef2f22ddfc6b1e3b67acbbaa7c74cb6187eae1b
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1224421
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+29 -33
+1 -1
cue/context.go
··· 378 378 return c.make(n) 379 379 } 380 380 381 - // Encode converts a Go type to a CUE [Value]. 381 + // EncodeType converts a Go type to a CUE [Value]. 382 382 // 383 383 // The returned value will represent an error, accessible through [Value.Err], 384 384 // if any error occurred.
+1 -3
cue/instance.go
··· 199 199 return v.Context().BuildExpr(expr, Scope(v), InferBuiltins(true)) 200 200 } 201 201 202 - // DO NOT USE. 203 - // 204 - // Deprecated: do not use. 202 + // Deprecated: do not use; use unification instead. 205 203 func Merge(inst ...*Instance) *Instance { 206 204 v := &adt.Vertex{} 207 205
+2 -2
cue/literal/quote.go
··· 53 53 return f 54 54 } 55 55 56 - // WithOptionalIndent is like WithTabIndent, but only returns a multiline 56 + // WithOptionalTabIndent is like [Form.WithTabIndent], but only returns a multiline 57 57 // strings if it doesn't contain any newline characters. 58 58 func (f Form) WithOptionalTabIndent(tabs int) Form { 59 59 f.indent = strings.Repeat("\t", tabs) ··· 82 82 // TODO: ExactString: quotes to bytes type if the string cannot be 83 83 // represented without loss of accuracy. 84 84 85 - // Label is like String, but optimized for labels. 85 + // Label is like [String], but optimized for labels. 86 86 Label Form = stringForm 87 87 88 88 // Bytes defines the format of bytes literal.
+2
cue/load/errors.go
··· 43 43 } 44 44 45 45 // TODO(localize) 46 + 46 47 func (p *PackageError) Error() string { 47 48 // Import cycles deserve special treatment. 48 49 if p.IsImportCycle { ··· 73 74 func (e *NoFilesError) Path() []string { return nil } 74 75 75 76 // TODO(localize) 77 + 76 78 func (e *NoFilesError) Msg() (string, []interface{}) { 77 79 // Count files beginning with _, which we will pretend don't exist at all. 78 80 dummy := 0
+3 -3
cue/path.go
··· 530 530 return adt.MakeIdentLabel(r, s.name, s.pkg) 531 531 } 532 532 533 - // A Def marks a string as a definition label. An # will be added if a string is 533 + // Def marks a string as a definition label. An # will be added if a string is 534 534 // not prefixed with a #. It will panic if s cannot be written as a valid 535 535 // identifier. 536 536 func Def(s string) Selector { ··· 562 562 return adt.MakeIdentLabel(r, string(d), "") 563 563 } 564 564 565 - // A Str is a CUE string label. Definition selectors are defined with Def. 565 + // Str creates a CUE string label. Definition selectors are defined with [Def]. 566 566 func Str(s string) Selector { 567 567 return Selector{stringSelector(s)} 568 568 } ··· 585 585 return adt.MakeStringLabel(r, string(s)) 586 586 } 587 587 588 - // An Index selects a list element by index. 588 + // Index selects a list element by index. 589 589 // It returns an invalid selector if the index is out of range. 590 590 func Index[T interface{ int | int64 }](x T) Selector { 591 591 f, err := adt.MakeLabel(nil, int64(x), adt.IntLabel)
+2 -2
cue/types.go
··· 1013 1013 return src 1014 1014 } 1015 1015 1016 - // If v exactly represents a package, BuildInstance returns 1017 - // the build instance corresponding to the value; otherwise it returns nil. 1016 + // BuildInstance returns the build instance corresponding to the value 1017 + // if v exactly represents a package; otherwise it returns nil. 1018 1018 // 1019 1019 // The value returned by [Value.ReferencePath] will commonly represent a package. 1020 1020 func (v Value) BuildInstance() *build.Instance {
+1 -1
cuego/cuego.go
··· 28 28 // DefaultContext is the shared context used with top-level functions. 29 29 var DefaultContext = &Context{} 30 30 31 - // MustConstrain is like Constrain, but panics if there is an error. 31 + // MustConstrain is like [Constrain], but panics if there is an error. 32 32 func MustConstrain(x interface{}, constraints string) { 33 33 if err := Constrain(x, constraints); err != nil { 34 34 panic(err)
+2 -2
cuego/doc.go
··· 36 36 // 37 37 // # Validating Go Values 38 38 // 39 - // To check whether a struct's values satisfy its constraints, call Validate: 39 + // To check whether a struct's values satisfy its constraints, call [Validate]: 40 40 // 41 41 // if err := cuego.Validate(p); err != nil { 42 42 // return err 43 43 // } 44 44 // 45 45 // Validation assumes that all values are filled in correctly and will not 46 - // infer values. To automatically infer values, use Complete. 46 + // infer values. To automatically infer values, use [Complete]. 47 47 // 48 48 // # Completing Go Values 49 49 //
+2 -2
internal/core/adt/kind.go
··· 134 134 return toString(k, kindStrs) 135 135 } 136 136 137 - // TypeString is like String, but returns a string representation of a valid 138 - // CUE type. 137 + // TypeString is like [Kind.String], 138 + // but returns a string representation of a valid CUE type. 139 139 func (k Kind) TypeString() string { 140 140 return toString(k, typeStrs) 141 141 }
+1 -1
mod/modfile/modfile.go
··· 211 211 }, nil 212 212 } 213 213 214 - // ParseNonStrict is like Parse but allows some laxity in the parsing: 214 + // ParseNonStrict is like [Parse] but allows some laxity in the parsing: 215 215 // - if a module path lacks a version, it's taken from the version. 216 216 // - if a non-canonical version is used, it will be canonicalized. 217 217 //
+1 -1
mod/modregistrytest/registry.go
··· 130 130 return NewServer(ocifilter.ReadOnly(r), authConfig) 131 131 } 132 132 133 - // NewServer is like New except that instead of uploading 133 + // NewServer is like [New] except that instead of uploading 134 134 // the contents of a filesystem, it just serves the contents 135 135 // of the given registry guarded by the given auth configuration. 136 136 // If auth is nil, no authentication will be required.
+1 -1
mod/module/dirfs.go
··· 16 16 Dir string 17 17 } 18 18 19 - // ReadCUE can be implemented by an [fs.FS] 19 + // ReadCUEFS can be implemented by an [fs.FS] 20 20 // to provide an optimized (cached) way of 21 21 // reading and parsing CUE syntax. 22 22 type ReadCUEFS interface {
+1 -1
mod/module/path.go
··· 105 105 return unicode.IsLetter(r) 106 106 } 107 107 108 - // CheckPathWithoutVersion is like CheckPath except that 108 + // CheckPathWithoutVersion is like [CheckPath] except that 109 109 // it expects a module path without a major version. 110 110 func CheckPathWithoutVersion(basePath string) (err error) { 111 111 if _, _, ok := SplitPathVersion(basePath); ok {
-3
mod/module/versions.go
··· 7 7 // Versions implements mvs.Versions[Version]. 8 8 type Versions struct{} 9 9 10 - // New implements mvs.Versions[Version].Version. 11 10 func (Versions) Version(v Version) string { 12 11 return v.Version() 13 12 } 14 13 15 - // New implements mvs.Versions[Version].Path. 16 14 func (Versions) Path(v Version) string { 17 15 return v.Path() 18 16 } 19 17 20 - // New implements mvs.Versions[Version].New. 21 18 func (Versions) New(p, v string) (Version, error) { 22 19 return NewVersion(p, v) 23 20 }
+1 -1
pkg/net/ip.go
··· 180 180 return netGetIP(ip).IsInterfaceLocalMulticast() 181 181 } 182 182 183 - // LinkLocalMulticast reports whether ip is a link-local multicast address. 183 + // LinkLocalMulticastIP reports whether ip is a link-local multicast address. 184 184 func LinkLocalMulticastIP(ip cue.Value) bool { 185 185 return netGetIP(ip).IsLinkLocalMulticast() 186 186 }
+1 -1
pkg/net/url.go
··· 57 57 return err == nil, err 58 58 } 59 59 60 - // URL validates that s is an absolute URL. 60 + // AbsURL validates that s is an absolute URL. 61 61 // Note: this does also allow non-ASCII characters. 62 62 func AbsURL(s string) (bool, error) { 63 63 u, err := url.Parse(s)
+4 -4
pkg/regexp/manual.go
··· 92 92 return m, nil 93 93 } 94 94 95 - // FindAllNamedSubmatch is like FindAllSubmatch, but returns a list of maps 96 - // with the named used in capturing groups. See FindNamedSubmatch for an 95 + // FindAllNamedSubmatch is like [FindAllSubmatch], but returns a list of maps 96 + // with the named used in capturing groups. See [FindNamedSubmatch] for an 97 97 // example on how to use named groups. 98 98 func FindAllNamedSubmatch(pattern, s string, n int) ([]map[string]string, error) { 99 99 re, err := regexp.Compile(pattern) ··· 123 123 124 124 var errNoNamedGroup = errors.New("no named groups") 125 125 126 - // FindAllSubmatch is the 'All' version of FindSubmatch; it returns a list 126 + // FindAllSubmatch is the 'All' version of [FindSubmatch]; it returns a list 127 127 // of all successive matches of the expression, as defined by the 'All' 128 128 // description in the package comment. 129 129 // A return value of bottom indicates no match. ··· 139 139 return m, nil 140 140 } 141 141 142 - // FindNamedSubmatch is like FindSubmatch, but returns a map with the names used 142 + // FindNamedSubmatch is like [FindSubmatch], but returns a map with the names used 143 143 // in capturing groups. 144 144 // 145 145 // Example:
-1
pkg/regexp/regexp.go
··· 24 24 25 25 // Match reports whether the string s 26 26 // contains any match of the regular expression pattern. 27 - // More complicated queries need to use Compile and the full Regexp interface. 28 27 func Match(pattern string, s string) (matched bool, err error) { 29 28 return regexp.MatchString(pattern, s) 30 29 }
+1 -1
pkg/strconv/strconv.go
··· 68 68 // IntSize is the size in bits of an int or uint value. 69 69 const IntSize = 64 70 70 71 - // ParseUint is like ParseInt but for unsigned numbers. 71 + // ParseUint is like [ParseInt] but for unsigned numbers. 72 72 func ParseUint(s string, base int, bitSize int) (*big.Int, error) { 73 73 if bitSize < 0 { 74 74 return nil, &strconv.NumError{
+2 -2
pkg/strings/strings.go
··· 174 174 // TrimLeft returns a slice of the string s with all leading 175 175 // Unicode code points contained in cutset removed. 176 176 // 177 - // To remove a prefix, use TrimPrefix instead. 177 + // To remove a prefix, use [TrimPrefix] instead. 178 178 func TrimLeft(s, cutset string) string { 179 179 return strings.TrimLeft(s, cutset) 180 180 } ··· 182 182 // TrimRight returns a slice of the string s, with all trailing 183 183 // Unicode code points contained in cutset removed. 184 184 // 185 - // To remove a suffix, use TrimSuffix instead. 185 + // To remove a suffix, use [TrimSuffix] instead. 186 186 func TrimRight(s, cutset string) string { 187 187 return strings.TrimRight(s, cutset) 188 188 }