зеркало из https://github.com/golang/tools.git
all: remove repetitive words
Change-Id: Idad45a4c8352116b68eca172329214dbfb89b294 Reviewed-on: https://go-review.googlesource.com/c/tools/+/509696 Run-TryBot: shuang cui <imcusg@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> gopls-CI: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Родитель
2842ed8496
Коммит
9161e3af9e
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
//
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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 == "/" {
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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{},
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче