Skip to content

Commit d99fbf4

Browse files
authored
Merge branch 'master' into 12ya-patch
2 parents eda2f3c + 1c017f1 commit d99fbf4

File tree

84 files changed

+525
-144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+525
-144
lines changed

cmd/signature-fuzzer/internal/fuzz-generator/gen_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func TestIsBuildable(t *testing.T) {
112112
verb(1, "output is: %s\n", string(coutput))
113113
}
114114

115-
// TestExhaustive does a series of code genreation runs, starting with
115+
// TestExhaustive does a series of code generation runs, starting with
116116
// (relatively) simple code and then getting progressively more
117117
// complex (more params, deeper structs, turning on additional
118118
// features such as address-taken vars and reflect testing). The

cmd/stringer/endtoend_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ func TestTestFiles(t *testing.T) {
286286
}
287287
}
288288

289-
// The -output flag cannot be used in combiation with matching types across multiple packages.
289+
// The -output flag cannot be used in combination with matching types across multiple packages.
290290
func TestCollidingOutput(t *testing.T) {
291291
testenv.NeedsTool(t, "go")
292292
stringer := stringerPath(t)

go/analysis/checker/example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func Example() {
6969
// min=bufio max=unsafe
7070
}
7171

72-
// minmaxpkg is a trival example analyzer that uses package facts to
72+
// minmaxpkg is a trivial example analyzer that uses package facts to
7373
// compute information from the entire dependency graph.
7474
var minmaxpkg = &analysis.Analyzer{
7575
Name: "minmaxpkg",

go/analysis/doc/suggested_fixes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ These requirements guarantee that suggested fixes can be cleanly applied.
7979
Because a driver may only analyze, or be able to modify, the current package,
8080
we restrict edits to the current package. In general this restriction should
8181
not be a big problem for users because other packages might not belong to the
82-
same module and so will not be safe to modify in a singe change.
82+
same module and so will not be safe to modify in a single change.
8383

8484
On the other hand, analyzers will not be required to produce gofmt-compliant
8585
code. Analysis drivers will be expected to apply gofmt to the results of

go/analysis/internal/checker/checker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func Run(args []string, analyzers []*analysis.Analyzer) (exitcode int) {
9999
// without having to remember what code to return.
100100
//
101101
// TODO(adonovan): interpreting exit codes is like reading tea-leaves.
102-
// Insted of wasting effort trying to encode a multidimensional result
102+
// Instead of wasting effort trying to encode a multidimensional result
103103
// into 7 bits we should just emit structured JSON output, and
104104
// an exit code of 0 or 1 for success or failure.
105105
exitAtLeast := func(code int) {

go/analysis/passes/asmdecl/asmdecl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ type asmArch struct {
5757
// include the first integer register and first floating-point register. Accessing
5858
// any of them counts as writing to result.
5959
retRegs []string
60-
// writeResult is a list of instructions that will change result register implicity.
60+
// writeResult is a list of instructions that will change result register implicitly.
6161
writeResult []string
6262
// calculated during initialization
6363
sizes types.Sizes

go/analysis/passes/loopclosure/loopclosure.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func run(pass *analysis.Pass) (any, error) {
8888
//
8989
// TODO: consider allowing the "last" go/defer/Go statement to be followed by
9090
// N "trivial" statements, possibly under a recursive definition of "trivial"
91-
// so that that checker could, for example, conclude that a go statement is
91+
// so that checker could, for example, conclude that a go statement is
9292
// followed by an if statement made of only trivial statements and trivial expressions,
9393
// and hence the go statement could still be checked.
9494
forEachLastStmt(body.List, func(last ast.Stmt) {

go/analysis/passes/structtag/structtag.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func checkCanonicalFieldTag(pass *analysis.Pass, field *types.Var, tag string, s
107107

108108
// Embedded struct. Nothing to do for now, but that
109109
// may change, depending on what happens with issue 7363.
110-
// TODO(adonovan): investigate, now that that issue is fixed.
110+
// TODO(adonovan): investigate, now that issue is fixed.
111111
if field.Anonymous() {
112112
return
113113
}

go/analysis/unitchecker/unitchecker_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func _() {
170170
// TODO(golang/go#65729): this is unsound: any extra
171171
// logging by the child process (e.g. due to GODEBUG
172172
// options) will add noise to stderr, causing the
173-
// CombinedOutput to be unparseable as JSON. But we
173+
// CombinedOutput to be unparsable as JSON. But we
174174
// can't simply use Output here as some of the tests
175175
// look for substrings of stderr. Rework the test to
176176
// be specific about which output stream to match.

go/callgraph/vta/graph.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ func (b *builder) call(c ssa.CallInstruction) {
658658
}
659659

660660
func addArgumentFlows(b *builder, c ssa.CallInstruction, f *ssa.Function) {
661-
// When f has no paremeters (including receiver), there is no type
661+
// When f has no parameters (including receiver), there is no type
662662
// flow here. Also, f's body and parameters might be missing, such
663663
// as when vta is used within the golang.org/x/tools/go/analysis
664664
// framework (see github.com/golang/go/issues/50670).
@@ -803,7 +803,7 @@ func (b *builder) nodeFromVal(val ssa.Value) node {
803803
return function{f: v}
804804
case *ssa.Parameter, *ssa.FreeVar, ssa.Instruction:
805805
// ssa.Param, ssa.FreeVar, and a specific set of "register" instructions,
806-
// satisifying the ssa.Value interface, can serve as local variables.
806+
// satisfying the ssa.Value interface, can serve as local variables.
807807
return local{val: v}
808808
default:
809809
panic(fmt.Errorf("unsupported value %v in node creation", val))

go/callgraph/vta/internal/trie/builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ func (b *Builder) create(leaves []*leaf) node {
245245
} else if n == 1 {
246246
return leaves[0]
247247
}
248-
// Note: we can do a more sophisicated algorithm by:
248+
// Note: we can do a more sophisticated algorithm by:
249249
// - sorting the leaves ahead of time,
250250
// - taking the prefix and branching bit of the min and max key,
251251
// - binary searching for the branching bit,

go/loader/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ package loader
164164
// entry is created in this cache by startLoad the first time the
165165
// package is imported. The first goroutine to request an entry becomes
166166
// responsible for completing the task and broadcasting completion to
167-
// subsequent requestors, which block until then.
167+
// subsequent requesters, which block until then.
168168
//
169169
// Type checking occurs in (parallel) postorder: we cannot type-check a
170170
// set of files until we have loaded and type-checked all of their

go/packages/overlay_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func testOverlayChangesBothPackageNames(t *testing.T, exporter packagestest.Expo
8181
t.Fatalf("failed to load: %v", err)
8282
}
8383
if len(initial) != 3 {
84-
t.Errorf("got %d packges, expected 3", len(initial))
84+
t.Errorf("got %d packages, expected 3", len(initial))
8585
}
8686
want := []struct {
8787
id, name string
@@ -127,7 +127,7 @@ func testOverlayChangesTestPackageName(t *testing.T, exporter packagestest.Expor
127127
t.Fatalf("failed to load: %v", err)
128128
}
129129
if len(initial) != 3 {
130-
t.Errorf("got %d packges, expected 3", len(initial))
130+
t.Errorf("got %d packages, expected 3", len(initial))
131131
}
132132
want := []struct {
133133
id, name string

go/packages/packages_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2676,7 +2676,7 @@ func testIssue48226(t *testing.T, exporter packagestest.Exporter) {
26762676
t.Fatal(err)
26772677
}
26782678
if len(initial) != 1 {
2679-
t.Fatalf("exepected 1 package, got %d", len(initial))
2679+
t.Fatalf("expected 1 package, got %d", len(initial))
26802680
}
26812681
pkg := initial[0]
26822682

@@ -2721,7 +2721,7 @@ func testModule(t *testing.T, exporter packagestest.Exporter) {
27212721
t.Fatal("package.Module: want non-nil, got nil")
27222722
}
27232723
if a.Module.Path != "golang.org/fake" {
2724-
t.Fatalf("package.Modile.Path: want \"golang.org/fake\", got %q", a.Module.Path)
2724+
t.Fatalf("package.Module.Path: want \"golang.org/fake\", got %q", a.Module.Path)
27252725
}
27262726
if a.Module.GoMod != filepath.Join(rootDir, "go.mod") {
27272727
t.Fatalf("package.Module.GoMod: want %q, got %q", filepath.Join(rootDir, "go.mod"), a.Module.GoMod)

go/ssa/builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ package ssa
2525
// populating fields such as Function.Body, .Params, and others.
2626
//
2727
// Building may create additional methods, including:
28-
// - wrapper methods (e.g. for embeddding, or implicit &recv)
28+
// - wrapper methods (e.g. for embedding, or implicit &recv)
2929
// - bound method closures (e.g. for use(recv.f))
3030
// - thunks (e.g. for use(I.f) or use(T.f))
3131
// - generic instances (e.g. to produce f[int] from f[any]).

go/ssa/builder_generic_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ func TestInstructionString(t *testing.T) {
766766

767767
// Expectation is a {function, type string} -> {want, matches}
768768
// where matches is all Instructions.String() that match the key.
769-
// Each expecation is that some permutation of matches is wants.
769+
// Each expectation is that some permutation of matches is wants.
770770
type expKey struct {
771771
function string
772772
kind string

go/ssa/interp/external.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"math"
1414
"os"
1515
"runtime"
16+
"slices"
1617
"sort"
1718
"strconv"
1819
"strings"
@@ -119,15 +120,7 @@ func ext۰bytes۰Equal(fr *frame, args []value) value {
119120
// func Equal(a, b []byte) bool
120121
a := args[0].([]value)
121122
b := args[1].([]value)
122-
if len(a) != len(b) {
123-
return false
124-
}
125-
for i := range a {
126-
if a[i] != b[i] {
127-
return false
128-
}
129-
}
130-
return true
123+
return slices.Equal(a, b)
131124
}
132125

133126
func ext۰bytes۰IndexByte(fr *frame, args []value) value {

go/ssa/subst.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ func (subst *subster) signature(t *types.Signature) types.Type {
543543
// We are choosing not to support tparams.Len() > 0 until a need has been observed in practice.
544544
//
545545
// There are some known usages for types.Types coming from types.{Eval,CheckExpr}.
546-
// To support tparams.Len() > 0, we just need to do the following [psuedocode]:
546+
// To support tparams.Len() > 0, we just need to do the following [pseudocode]:
547547
// targs := {subst.replacements[tparams[i]]]}; Instantiate(ctxt, t, targs, false)
548548

549549
assert(tparams.Len() == 0, "Substituting types.Signatures with generic functions are currently unsupported.")

go/ssa/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type unit struct{}
2525

2626
//// Sanity checking utilities
2727

28-
// assert panics with the mesage msg if p is false.
28+
// assert panics with the message msg if p is false.
2929
// Avoid combining with expensive string formatting.
3030
func assert(p bool, msg string) {
3131
if !p {

gopls/doc/assets/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This module contains no Go code, but serves to carve out a hole in
22
// its parent module to avoid bloating it with large image files that
3-
// would otherwise be dowloaded by "go install golang.org/x/tools/gopls@latest".
3+
// would otherwise be downloaded by "go install golang.org/x/tools/gopls@latest".
44

55
module golang.org/x/tools/gopls/doc/assets
66

gopls/doc/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ Jenkins-like Google infrastructure for running Dockerized tests. This allows us
188188
to run gopls tests in various environments that would be difficult to add to
189189
the TryBots. Notably, Kokoro runs tests on
190190
[older Go versions](../README.md#supported-go-versions) that are no longer supported
191-
by the TryBots. Per that that policy, support for these older Go versions is
191+
by the TryBots. Per that policy, support for these older Go versions is
192192
best-effort, and test failures may be skipped rather than fixed.
193193

194194
Kokoro runs are triggered by the `Run-TryBot=1` label, just like TryBots, but

gopls/doc/emacs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ project root.
110110
111111
;; Optional: install eglot-format-buffer as a save hook.
112112
;; The depth of -10 places this before eglot's willSave notification,
113-
;; so that that notification reports the actual contents that will be saved.
113+
;; so that notification reports the actual contents that will be saved.
114114
(defun eglot-format-buffer-before-save ()
115115
(add-hook 'before-save-hook #'eglot-format-buffer -10 t))
116116
(add-hook 'go-mode-hook #'eglot-format-buffer-before-save)

gopls/doc/features/passive.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ structures, or when reading assembly files or stack traces that refer
4646
to each field by its cryptic byte offset.
4747

4848
In addition, Hover reports:
49-
- the struct's size class, which is the number of of bytes actually
49+
- the struct's size class, which is the number of bytes actually
5050
allocated by the Go runtime for a single object of this type; and
5151
- the percentage of wasted space due to suboptimal ordering of struct
5252
fields, if this figure is 20% or higher:

gopls/doc/features/templates.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ value, since Go templates don't have a canonical file extension.)
1414

1515
Additional configuration may be necessary to ensure that your client
1616
chooses the correct language kind when opening template files.
17-
Gopls recogizes both `"tmpl"` and `"gotmpl"` for template files.
17+
Gopls recognizes both `"tmpl"` and `"gotmpl"` for template files.
1818
For example, in `VS Code` you will also need to add an
1919
entry to the
2020
[`files.associations`](https://code.visualstudio.com/docs/languages/identifiers)

gopls/doc/release/v0.17.0.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ reduce the considerable costs to us of testing against older Go versions,
1717
allowing us to spend more time fixing bugs and adding features that benefit the
1818
majority of gopls users who run recent versions of Go.
1919

20-
This narrowing is occuring in two dimensions: **build compatibility** refers to
20+
This narrowing is occurring in two dimensions: **build compatibility** refers to
2121
the versions of the Go toolchain that can be used to build gopls, and **go
2222
command compatibility** refers to the versions of the `go` command that can be
2323
used by gopls to list information about packages and modules in your workspace.
@@ -110,7 +110,7 @@ The user can invoke this code action by selecting a function name, the keywords
110110
or by selecting a whole declaration or multiple declarations.
111111

112112
In order to avoid ambiguity and surprise about what to extract, some kinds
113-
of paritial selection of a declaration cannot invoke this code action.
113+
of partial selection of a declaration cannot invoke this code action.
114114

115115
### Extract constant
116116

gopls/doc/release/v0.19.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Slightly more than half of the analyzers in the
3535
enabled by default. This subset has been chosen for precision and
3636
efficiency.
3737

38-
Prevously, Staticcheck analyzers (all of them) would be run only if
38+
Previously, Staticcheck analyzers (all of them) would be run only if
3939
the experimental `staticcheck` boolean option was set to `true`. This
4040
value continues to enable the complete set, and a value of `false`
4141
continues to disable the complete set. Leaving the option unspecified

gopls/internal/analysis/modernize/testdata/src/minmax/minmax.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func fix72727(a, b int) {
139139

140140
type myfloat float64
141141

142-
// The built-in min/max differ in their treatement of NaN,
142+
// The built-in min/max differ in their treatment of NaN,
143143
// so reject floating-point numbers (#72829).
144144
func nopeFloat(a, b myfloat) (res myfloat) {
145145
if a < b {

gopls/internal/analysis/modernize/testdata/src/minmax/minmax.go.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func fix72727(a, b int) {
126126

127127
type myfloat float64
128128

129-
// The built-in min/max differ in their treatement of NaN,
129+
// The built-in min/max differ in their treatment of NaN,
130130
// so reject floating-point numbers (#72829).
131131
func nopeFloat(a, b myfloat) (res myfloat) {
132132
if a < b {

gopls/internal/analysis/unusedparams/testdata/src/generatedcode/nongeneratedcode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type implementsGeneratedInterface struct{}
1212
// in the generated code.
1313
func (implementsGeneratedInterface) n(f bool) {
1414
// The body must not be empty, otherwise unusedparams will
15-
// not report the unused parameter regardles of the
15+
// not report the unused parameter regardless of the
1616
// interface.
1717
println()
1818
}

gopls/internal/analysis/unusedparams/testdata/src/generatedcode/nongeneratedcode.go.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type implementsGeneratedInterface struct{}
1212
// in the generated code.
1313
func (implementsGeneratedInterface) n(f bool) {
1414
// The body must not be empty, otherwise unusedparams will
15-
// not report the unused parameter regardles of the
15+
// not report the unused parameter regardless of the
1616
// interface.
1717
println()
1818
}

gopls/internal/analysis/yield/yield.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ package yield
1414
//
1515
// seq(yield)
1616
//
17-
// to avoid unnecesary range desugaring and chains of dynamic calls.
17+
// to avoid unnecessary range desugaring and chains of dynamic calls.
1818

1919
import (
2020
_ "embed"

gopls/internal/cache/check.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,15 +1688,15 @@ func (b *typeCheckBatch) checkPackage(ctx context.Context, fset *token.FileSet,
16881688

16891689
// Track URIs with parse errors so that we can suppress type errors for these
16901690
// files.
1691-
unparseable := map[protocol.DocumentURI]bool{}
1691+
unparsable := map[protocol.DocumentURI]bool{}
16921692
for _, e := range pkg.parseErrors {
16931693
diags, err := parseErrorDiagnostics(pkg, e)
16941694
if err != nil {
16951695
event.Error(ctx, "unable to compute positions for parse errors", err, label.Package.Of(string(inputs.id)))
16961696
continue
16971697
}
16981698
for _, diag := range diags {
1699-
unparseable[diag.URI] = true
1699+
unparsable[diag.URI] = true
17001700
pkg.diagnostics = append(pkg.diagnostics, diag)
17011701
}
17021702
}
@@ -1706,7 +1706,7 @@ func (b *typeCheckBatch) checkPackage(ctx context.Context, fset *token.FileSet,
17061706
// If the file didn't parse cleanly, it is highly likely that type
17071707
// checking errors will be confusing or redundant. But otherwise, type
17081708
// checking usually provides a good enough signal to include.
1709-
if !unparseable[diag.URI] {
1709+
if !unparsable[diag.URI] {
17101710
pkg.diagnostics = append(pkg.diagnostics, diag)
17111711
}
17121712
}

gopls/internal/cache/mod_tidy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (s *Snapshot) ModTidy(ctx context.Context, pm *ParsedModule) (*TidiedModule
4545

4646
uri := pm.URI
4747
if pm.File == nil {
48-
return nil, fmt.Errorf("cannot tidy unparseable go.mod file: %v", uri)
48+
return nil, fmt.Errorf("cannot tidy unparsable go.mod file: %v", uri)
4949
}
5050

5151
s.mu.Lock()

gopls/internal/cache/parse_cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ func (c *parseCache) parseFiles(ctx context.Context, fset *token.FileSet, mode p
391391

392392
// -- priority queue boilerplate --
393393

394-
// queue is a min-atime prority queue of cache entries.
394+
// queue is a min-atime priority queue of cache entries.
395395
type queue []*parseCacheEntry
396396

397397
func (q queue) Len() int { return len(q) }

gopls/internal/cache/parsego/parse.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func Parse(ctx context.Context, fset *token.FileSet, uri protocol.DocumentURI, s
8282
}
8383

8484
for i := range 10 {
85-
// Fix certain syntax errors that render the file unparseable.
85+
// Fix certain syntax errors that render the file unparsable.
8686
newSrc, srcFix := fixSrc(file, tok, src)
8787
if newSrc == nil {
8888
break
@@ -213,7 +213,7 @@ func fixAST(n ast.Node, tok *token.File, src []byte) (fixes []FixType) {
213213
return fixes
214214
}
215215

216-
// TODO(rfindley): revert this intrumentation once we're certain the crash in
216+
// TODO(rfindley): revert this instrumentation once we're certain the crash in
217217
// #59097 is fixed.
218218
type FixType int
219219

0 commit comments

Comments
 (0)