From 9161e3af9ee362965758136c3f9c83a5a2ef043c Mon Sep 17 00:00:00 2001 From: cui fliter Date: Fri, 14 Jul 2023 14:55:17 +0800 Subject: [PATCH] all: remove repetitive words Change-Id: Idad45a4c8352116b68eca172329214dbfb89b294 Reviewed-on: https://go-review.googlesource.com/c/tools/+/509696 Run-TryBot: shuang cui TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Reviewed-by: Heschi Kreinick Auto-Submit: Ian Lance Taylor gopls-CI: kokoro --- cmd/godoc/main.go | 2 +- go/analysis/passes/atomicalign/atomicalign.go | 4 ++-- go/callgraph/vta/internal/trie/builder.go | 4 ++-- go/packages/packages.go | 2 +- go/ssa/builder.go | 2 +- go/ssa/emit.go | 2 +- godoc/index.go | 2 +- godoc/versions.go | 2 +- godoc/vfs/emptyvfs.go | 2 +- gopls/internal/lsp/diagnostics.go | 2 +- gopls/internal/lsp/fake/sandbox.go | 2 +- gopls/internal/lsp/filecache/filecache.go | 2 +- gopls/internal/lsp/server.go | 2 +- gopls/internal/lsp/source/inlay_hint.go | 2 +- gopls/internal/lsp/source/references.go | 2 +- gopls/internal/lsp/source/rename.go | 2 +- internal/diff/diff.go | 2 +- internal/gocommand/invoke.go | 4 ++-- internal/imports/mod_cache.go | 2 +- internal/jsonrpc2_v2/serve.go | 2 +- internal/persistent/map.go | 2 +- 21 files changed, 24 insertions(+), 24 deletions(-) diff --git a/cmd/godoc/main.go b/cmd/godoc/main.go index 79dcf38210a..a4ca1c4c175 100644 --- a/cmd/godoc/main.go +++ b/cmd/godoc/main.go @@ -226,7 +226,7 @@ func main() { } else { // Try to download dependencies that are not in the module cache in order to - // to show their documentation. + // show their documentation. // This may fail if module downloading is disallowed (GOPROXY=off) or due to // limited connectivity, in which case we print errors to stderr and show // documentation only for packages that are available. diff --git a/go/analysis/passes/atomicalign/atomicalign.go b/go/analysis/passes/atomicalign/atomicalign.go index fc2ce3052d8..01683e45a2b 100644 --- a/go/analysis/passes/atomicalign/atomicalign.go +++ b/go/analysis/passes/atomicalign/atomicalign.go @@ -75,8 +75,8 @@ func run(pass *analysis.Pass) (interface{}, error) { func check64BitAlignment(pass *analysis.Pass, funcName string, arg ast.Expr) { // Checks the argument is made of the address operator (&) applied to - // to a struct field (as opposed to a variable as the first word of - // uint64 and int64 variables can be relied upon to be 64-bit aligned. + // a struct field (as opposed to a variable as the first word of + // uint64 and int64 variables can be relied upon to be 64-bit aligned). unary, ok := arg.(*ast.UnaryExpr) if !ok || unary.Op != token.AND { return diff --git a/go/callgraph/vta/internal/trie/builder.go b/go/callgraph/vta/internal/trie/builder.go index 11ff59b1bb9..08f14c6793d 100644 --- a/go/callgraph/vta/internal/trie/builder.go +++ b/go/callgraph/vta/internal/trie/builder.go @@ -378,7 +378,7 @@ func (b *Builder) merge(c Collision, lhs, rhs node) node { } } - // Last remaining case is branch branch merging. + // Last remaining case is branch merging. // For brevity, we adopt the Okasaki and Gill naming conventions // for branching and prefixes. s, t := lhs.(*branch), rhs.(*branch) @@ -472,7 +472,7 @@ func (b *Builder) intersect(c Collision, l, r node) node { // fallthrough } } - // Last remaining case is branch branch intersection. + // Last remaining case is branch intersection. s, t := l.(*branch), r.(*branch) p, m := s.prefix, s.branching q, n := t.prefix, t.branching diff --git a/go/packages/packages.go b/go/packages/packages.go index ac289750926..6434022eea5 100644 --- a/go/packages/packages.go +++ b/go/packages/packages.go @@ -630,7 +630,7 @@ func newLoader(cfg *Config) *loader { return ld } -// refine connects the supplied packages into a graph and then adds type and +// refine connects the supplied packages into a graph and then adds type // and syntax information as requested by the LoadMode. func (ld *loader) refine(response *driverResponse) ([]*Package, error) { roots := response.Roots diff --git a/go/ssa/builder.go b/go/ssa/builder.go index 11b6423191f..0e49537d00a 100644 --- a/go/ssa/builder.go +++ b/go/ssa/builder.go @@ -950,7 +950,7 @@ func (b *builder) stmtList(fn *Function, list []ast.Stmt) { // returns the effective receiver after applying the implicit field // selections of sel. // -// wantAddr requests that the result is an an address. If +// wantAddr requests that the result is an address. If // !sel.indirect, this may require that e be built in addr() mode; it // must thus be addressable. // diff --git a/go/ssa/emit.go b/go/ssa/emit.go index fe2f6f0f6d6..abb617e6d40 100644 --- a/go/ssa/emit.go +++ b/go/ssa/emit.go @@ -101,7 +101,7 @@ func emitArith(f *Function, op token.Token, x, y Value, t types.Type, pos token. } // emitCompare emits to f code compute the boolean result of -// comparison comparison 'x op y'. +// comparison 'x op y'. func emitCompare(f *Function, op token.Token, x, y Value, pos token.Pos) Value { xt := x.Type().Underlying() yt := y.Type().Underlying() diff --git a/godoc/index.go b/godoc/index.go index 4471f59167a..4195dd205f6 100644 --- a/godoc/index.go +++ b/godoc/index.go @@ -628,7 +628,7 @@ func (x *Indexer) addFile(f vfs.ReadSeekCloser, filename string, goFile bool) (f // The file set's base offset and x.sources size must be in lock-step; // this permits the direct mapping of suffix array lookup results to - // to corresponding Pos values. + // corresponding Pos values. // // When a file is added to the file set, its offset base increases by // the size of the file + 1; and the initial base offset is 1. Add an diff --git a/godoc/versions.go b/godoc/versions.go index 7342858f16f..849f4d6470c 100644 --- a/godoc/versions.go +++ b/godoc/versions.go @@ -72,7 +72,7 @@ type versionedRow struct { structName string // for struct fields, the outer struct name } -// versionParser parses $GOROOT/api/go*.txt files and stores them in in its rows field. +// versionParser parses $GOROOT/api/go*.txt files and stores them in its rows field. type versionParser struct { res apiVersions // initialized lazily } diff --git a/godoc/vfs/emptyvfs.go b/godoc/vfs/emptyvfs.go index 8712d5eba65..521bf71a51b 100644 --- a/godoc/vfs/emptyvfs.go +++ b/godoc/vfs/emptyvfs.go @@ -32,7 +32,7 @@ func (e *emptyVFS) Open(path string) (ReadSeekCloser, error) { return nil, os.ErrNotExist } -// Stat returns os.FileInfo for an empty directory if the path is +// Stat returns os.FileInfo for an empty directory if the path // is root "/" or error. os.FileInfo is implemented by emptyVFS func (e *emptyVFS) Stat(path string) (os.FileInfo, error) { if path == "/" { diff --git a/gopls/internal/lsp/diagnostics.go b/gopls/internal/lsp/diagnostics.go index 334a1791d27..47729658799 100644 --- a/gopls/internal/lsp/diagnostics.go +++ b/gopls/internal/lsp/diagnostics.go @@ -263,7 +263,7 @@ func (s *Server) diagnose(ctx context.Context, snapshot source.Snapshot, analyze // Wait for a free diagnostics slot. // TODO(adonovan): opt: shouldn't it be the analysis implementation's // job to de-dup and limit resource consumption? In any case this - // this function spends most its time waiting for awaitLoaded, at + // function spends most its time waiting for awaitLoaded, at // least initially. select { case <-ctx.Done(): diff --git a/gopls/internal/lsp/fake/sandbox.go b/gopls/internal/lsp/fake/sandbox.go index 7afdb99a818..41188af30fe 100644 --- a/gopls/internal/lsp/fake/sandbox.go +++ b/gopls/internal/lsp/fake/sandbox.go @@ -267,7 +267,7 @@ func (sb *Sandbox) RunGoCommand(ctx context.Context, dir, verb string, args, env return fmt.Errorf("go command failed (stdout: %s) (stderr: %s): %v", stdout.String(), stderr.String(), err) } // Since running a go command may result in changes to workspace files, - // check if we need to send any any "watched" file events. + // check if we need to send any "watched" file events. // // TODO(rFindley): this side-effect can impact the usability of the sandbox // for benchmarks. Consider refactoring. diff --git a/gopls/internal/lsp/filecache/filecache.go b/gopls/internal/lsp/filecache/filecache.go index 132fb7064b4..7d4b8b1b424 100644 --- a/gopls/internal/lsp/filecache/filecache.go +++ b/gopls/internal/lsp/filecache/filecache.go @@ -302,7 +302,7 @@ func SetBudget(new int64) (old int64) { // In particular, each gopls process attempts to garbage collect // the entire gopls directory so that newer binaries can clean up // after older ones: in the development cycle especially, new -// new versions may be created frequently. +// versions may be created frequently. func filename(kind string, key [32]byte) (string, error) { base := fmt.Sprintf("%x-%s", key, kind) dir, err := getCacheDir() diff --git a/gopls/internal/lsp/server.go b/gopls/internal/lsp/server.go index 79d16e1dd36..f0ec2a30195 100644 --- a/gopls/internal/lsp/server.go +++ b/gopls/internal/lsp/server.go @@ -25,7 +25,7 @@ import ( const concurrentAnalyses = 1 // NewServer creates an LSP server and binds it to handle incoming client -// messages on on the supplied stream. +// messages on the supplied stream. func NewServer(session *cache.Session, client protocol.ClientCloser) *Server { return &Server{ diagnostics: map[span.URI]*fileReports{}, diff --git a/gopls/internal/lsp/source/inlay_hint.go b/gopls/internal/lsp/source/inlay_hint.go index 0d0bb82ebe1..f323d56cb2c 100644 --- a/gopls/internal/lsp/source/inlay_hint.go +++ b/gopls/internal/lsp/source/inlay_hint.go @@ -157,7 +157,7 @@ func parameterNames(node ast.Node, m *protocol.Mapper, tf *token.File, info *typ if param.Name() == "" { continue } - // Skip the parameter name hint if the arg matches the + // Skip the parameter name hint if the arg matches // the parameter name. if i, ok := v.(*ast.Ident); ok && i.Name == param.Name() { continue diff --git a/gopls/internal/lsp/source/references.go b/gopls/internal/lsp/source/references.go index 166c59d5f84..84193992cc6 100644 --- a/gopls/internal/lsp/source/references.go +++ b/gopls/internal/lsp/source/references.go @@ -332,7 +332,7 @@ func ordinaryReferences(ctx context.Context, snapshot Snapshot, uri span.URI, pp // The scope is the union of rdeps of each variant. // (Each set is disjoint so there's no benefit to - // to combining the metadata graph traversals.) + // combining the metadata graph traversals.) for _, m := range variants { if err := addRdeps(m.ID, transitive); err != nil { return nil, err diff --git a/gopls/internal/lsp/source/rename.go b/gopls/internal/lsp/source/rename.go index d0308cd460b..40810dd8f82 100644 --- a/gopls/internal/lsp/source/rename.go +++ b/gopls/internal/lsp/source/rename.go @@ -774,7 +774,7 @@ func renamePackage(ctx context.Context, s Snapshot, f FileHandle, newName Packag edits := make(map[span.URI][]diff.Edit) for _, m := range allMetadata { // Special case: x_test packages for the renamed package will not have the - // package path as as a dir prefix, but still need their package clauses + // package path as a dir prefix, but still need their package clauses // renamed. if m.PkgPath == oldPkgPath+"_test" { if err := renamePackageClause(ctx, m, s, newName+"_test", edits); err != nil { diff --git a/internal/diff/diff.go b/internal/diff/diff.go index 19de1b28e94..a13547b7a7e 100644 --- a/internal/diff/diff.go +++ b/internal/diff/diff.go @@ -153,7 +153,7 @@ expand: // expandEdit returns edit expanded to complete whole lines. func expandEdit(edit Edit, src string) Edit { // Expand start left to start of line. - // (delta is the zero-based column number of of start.) + // (delta is the zero-based column number of start.) start := edit.Start if delta := start - 1 - strings.LastIndex(src[:start], "\n"); delta > 0 { edit.Start -= delta diff --git a/internal/gocommand/invoke.go b/internal/gocommand/invoke.go index 8d9fc98d8f5..53cf66da019 100644 --- a/internal/gocommand/invoke.go +++ b/internal/gocommand/invoke.go @@ -319,7 +319,7 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) (err error) { // Per https://pkg.go.dev/os#File.Close, the call to stdoutR.Close // should cause the Read call in io.Copy to unblock and return // immediately, but we still need to receive from stdoutErr to confirm - // that that has happened. + // that it has happened. <-stdoutErr err2 = ctx.Err() } @@ -333,7 +333,7 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) (err error) { // one goroutine at a time will call Write.” // // Since we're starting a goroutine that writes to cmd.Stdout, we must - // also update cmd.Stderr so that that still holds. + // also update cmd.Stderr so that it still holds. func() { defer func() { recover() }() if cmd.Stderr == prevStdout { diff --git a/internal/imports/mod_cache.go b/internal/imports/mod_cache.go index 18dada495ca..45690abbb4f 100644 --- a/internal/imports/mod_cache.go +++ b/internal/imports/mod_cache.go @@ -12,7 +12,7 @@ import ( "golang.org/x/tools/internal/gopathwalk" ) -// To find packages to import, the resolver needs to know about all of the +// To find packages to import, the resolver needs to know about all of // the packages that could be imported. This includes packages that are // already in modules that are in (1) the current module, (2) replace targets, // and (3) packages in the module cache. Packages in (1) and (2) may change over diff --git a/internal/jsonrpc2_v2/serve.go b/internal/jsonrpc2_v2/serve.go index 5e082735469..7bac0103e8f 100644 --- a/internal/jsonrpc2_v2/serve.go +++ b/internal/jsonrpc2_v2/serve.go @@ -104,7 +104,7 @@ func (s *Server) run(ctx context.Context) { rwc, err := s.listener.Accept(ctx) if err != nil { // Only Shutdown closes the listener. If we get an error after Shutdown is - // called, assume that that was the cause and don't report the error; + // called, assume that was the cause and don't report the error; // otherwise, report the error in case it is unexpected. if atomic.LoadInt32(&s.closing) == 0 { s.async.setError(err) diff --git a/internal/persistent/map.go b/internal/persistent/map.go index b29cfe41943..a5d30834e21 100644 --- a/internal/persistent/map.go +++ b/internal/persistent/map.go @@ -242,7 +242,7 @@ func union(first, second *mapNode, less func(a, b interface{}) bool, overwrite b // // split(n:-0) (left:+1, mid:+1, right:+1) // Split borrows n without affecting its refcount, and returns three -// new references that that caller is expected to call decref. +// new references that the caller is expected to call decref. func split(n *mapNode, key interface{}, less func(a, b interface{}) bool, requireMid bool) (left, mid, right *mapNode) { if n == nil { return nil, nil, nil