зеркало из https://github.com/golang/tools.git
all: fix more typos
Change-Id: I978ad5e1800ebfceb78aaced438331a8341715d4 Reviewed-on: https://go-review.googlesource.com/c/tools/+/194697 Reviewed-by: Toshihiro Shiino <shiino.toshihiro@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Родитель
663385e6ef
Коммит
feee8acb39
|
@ -397,7 +397,7 @@ func digraph(cmd string, args []string) error {
|
|||
|
||||
case "transpose":
|
||||
if len(args) != 0 {
|
||||
return fmt.Errorf("usage: digraph tranpose")
|
||||
return fmt.Errorf("usage: digraph transpose")
|
||||
}
|
||||
var revEdges []string
|
||||
for node, succs := range g.transpose() {
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
// The -baddomains flag is a list of domain names that should always be
|
||||
// considered non-canonical. You can use this if you wish to make sure
|
||||
// that you no longer have any dependencies on packages from that
|
||||
// domain, even those that do not yet provide a canical import path
|
||||
// domain, even those that do not yet provide a canonical import path
|
||||
// comment. For example, the default value of -baddomains includes the
|
||||
// moribund code hosting site code.google.com, so fiximports will report
|
||||
// an error for each import of a package from this domain remaining
|
||||
|
|
|
@ -25,7 +25,7 @@ type Golden struct {
|
|||
trimPrefix string
|
||||
lineComment bool
|
||||
input string // input; the package clause is provided when running the test.
|
||||
output string // exected output.
|
||||
output string // expected output.
|
||||
}
|
||||
|
||||
var golden = []Golden{
|
||||
|
|
|
@ -329,7 +329,7 @@ func (ex expectation) String() string {
|
|||
}
|
||||
|
||||
// parseExpectations parses the content of a "// want ..." comment
|
||||
// and returns the expections, a mixture of diagnostics ("rx") and
|
||||
// and returns the expectations, a mixture of diagnostics ("rx") and
|
||||
// facts (name:"rx").
|
||||
func parseExpectations(text string) ([]expectation, error) {
|
||||
var scanErr string
|
||||
|
|
|
@ -42,7 +42,7 @@ func main() {
|
|||
print() // want foo:
|
||||
print() // want "\xZZ scan error"
|
||||
|
||||
// A dignostic is reported at this line, but the expectation doesn't match:
|
||||
// A diagnostic is reported at this line, but the expectation doesn't match:
|
||||
println("hello, world") // want "wrong expectation text"
|
||||
|
||||
// An unexpected diagnostic is reported at this line:
|
||||
|
|
|
@ -110,7 +110,7 @@ code review systems to suggest fixes that users can apply from their code review
|
|||
|
||||
### Performing transformations directly on the AST
|
||||
|
||||
Even though it may be more convienient
|
||||
Even though it may be more convenient
|
||||
for authors of refactorings to perform transformations directly on
|
||||
the AST, allowing mutations on the AST would mean that a copy of the AST
|
||||
would need to be made every time a transformation was produced, to avoid
|
||||
|
|
|
@ -209,7 +209,7 @@ func (versionFlag) Set(s string) error {
|
|||
log.Fatalf("unsupported flag value: -V=%s", s)
|
||||
}
|
||||
|
||||
// This replicates the miminal subset of
|
||||
// This replicates the minimal subset of
|
||||
// cmd/internal/objabi.AddVersionFlag, which is private to the
|
||||
// go tool yet forms part of our command-line interface.
|
||||
// TODO(adonovan): clarify the contract.
|
||||
|
|
|
@ -457,7 +457,7 @@ func printDiagnostics(roots []*action) (exitcode int) {
|
|||
visitAll(roots)
|
||||
|
||||
if exitcode == 0 && len(seen) > 0 {
|
||||
exitcode = 3 // successfuly produced diagnostics
|
||||
exitcode = 3 // successfully produced diagnostics
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ func Foo() {
|
|||
|
||||
got := string(contents)
|
||||
if got != want {
|
||||
t.Errorf("contents of rewrtitten file\ngot: %s\nwant: %s", got, want)
|
||||
t.Errorf("contents of rewritten file\ngot: %s\nwant: %s", got, want)
|
||||
}
|
||||
|
||||
defer cleanup()
|
||||
|
|
|
@ -234,7 +234,7 @@ func matchStructArgType(pass *analysis.Pass, t printfArgType, typ *types.Struct,
|
|||
return false
|
||||
}
|
||||
if t&argString != 0 && !typf.Exported() && isConvertibleToString(pass, typf.Type()) {
|
||||
// Issue #17798: unexported Stringer or error cannot be properly fomatted.
|
||||
// Issue #17798: unexported Stringer or error cannot be properly formatted.
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ func OverlayContext(orig *build.Context, overlay map[string][]byte) *build.Conte
|
|||
//
|
||||
// The archive consists of a series of files. Each file consists of a
|
||||
// name, a decimal file size and the file contents, separated by
|
||||
// newlinews. No newline follows after the file contents.
|
||||
// newlines. No newline follows after the file contents.
|
||||
func ParseOverlayArchive(archive io.Reader) (map[string][]byte, error) {
|
||||
overlay := make(map[string][]byte)
|
||||
r := bufio.NewReader(archive)
|
||||
|
|
|
@ -245,7 +245,7 @@ func equalType(x, y types.Type) error {
|
|||
return fmt.Errorf("results: %s", err)
|
||||
}
|
||||
if x.Variadic() != y.Variadic() {
|
||||
return fmt.Errorf("unequal varidicity: %t vs %t",
|
||||
return fmt.Errorf("unequal variadicity: %t vs %t",
|
||||
x.Variadic(), y.Variadic())
|
||||
}
|
||||
if (x.Recv() != nil) != (y.Recv() != nil) {
|
||||
|
|
|
@ -678,7 +678,7 @@ func golistDriver(cfg *Config, rootsDirs func() *goInfo, words ...string) (*driv
|
|||
// go list -e, when given an absolute path, will find the package contained at
|
||||
// that directory. But when no package exists there, it will return a fake package
|
||||
// with an error and the ImportPath set to the absolute path provided to go list.
|
||||
// Try toto convert that absolute path to what its package path would be if it's
|
||||
// Try to convert that absolute path to what its package path would be if it's
|
||||
// contained in a known module or GOPATH entry. This will allow the package to be
|
||||
// properly "reclaimed" when overlays are processed.
|
||||
if filepath.IsAbs(p.ImportPath) && p.Error != nil {
|
||||
|
|
|
@ -2158,7 +2158,7 @@ func testAdHocContains(t *testing.T, exporter packagestest.Exporter) {
|
|||
t.Fatalf("Imports of loaded package: want [fmt], got %v", pkg.Imports)
|
||||
}
|
||||
if len(pkg.GoFiles) != 1 || pkg.GoFiles[0] != filename {
|
||||
t.Fatalf("GoFiles of loaded packge: want [%s], got %v", filename, pkg.GoFiles)
|
||||
t.Fatalf("GoFiles of loaded package: want [%s], got %v", filename, pkg.GoFiles)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ func (e *Exported) Expect(methods map[string]interface{}) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Range is a type alias for span.Range for backwards compatability, prefer
|
||||
// Range is a type alias for span.Range for backwards compatibility, prefer
|
||||
// using span.Range directly.
|
||||
type Range = span.Range
|
||||
|
||||
|
|
|
@ -512,7 +512,7 @@ func (a *analysis) genAppend(instr *ssa.Call, cgn *cgnode) {
|
|||
a.addressOf(instr.Type(), a.valueNode(z), w) // z = &w
|
||||
}
|
||||
|
||||
// genBuiltinCall generates contraints for a call to a built-in.
|
||||
// genBuiltinCall generates constraints for a call to a built-in.
|
||||
func (a *analysis) genBuiltinCall(instr ssa.CallInstruction, cgn *cgnode) {
|
||||
call := instr.Common()
|
||||
switch call.Value.(*ssa.Builtin).Name() {
|
||||
|
|
|
@ -89,7 +89,7 @@ package pointer
|
|||
// their expanded-out sets are equal.
|
||||
// * HR (HVN with deReference---see paper): this will require that we
|
||||
// apply HVN until fixed point, which may need more bookkeeping of the
|
||||
// correspondance of main nodes to onodes.
|
||||
// correspondence of main nodes to onodes.
|
||||
// * Location Equivalence (see paper): have points-to sets contain not
|
||||
// locations but location-equivalence class labels, each representing
|
||||
// a set of locations.
|
||||
|
|
|
@ -46,7 +46,7 @@ func Packages(initial []*packages.Package, mode ssa.BuilderMode) (*ssa.Program,
|
|||
//
|
||||
// AllPackages creates an SSA package for each well-typed package in the
|
||||
// initial list, plus all their dependencies. The resulting list of
|
||||
// packages corresponds to the list of intial packages, and may contain
|
||||
// packages corresponds to the list of initial packages, and may contain
|
||||
// a nil if SSA code could not be constructed for the corresponding
|
||||
// initial package due to type errors.
|
||||
//
|
||||
|
|
|
@ -376,7 +376,7 @@ func Object(pkg *types.Package, p Path) (types.Object, error) {
|
|||
return nil, fmt.Errorf("package %s does not contain %q", pkg.Path(), pkgobj)
|
||||
}
|
||||
|
||||
// abtraction of *types.{Pointer,Slice,Array,Chan,Map}
|
||||
// abstraction of *types.{Pointer,Slice,Array,Chan,Map}
|
||||
type hasElem interface {
|
||||
Elem() types.Type
|
||||
}
|
||||
|
|
|
@ -881,7 +881,7 @@ func (p *Presentation) writeNode(w io.Writer, pageInfo *PageInfo, fset *token.Fi
|
|||
log.Print(err)
|
||||
}
|
||||
|
||||
// Add comments to struct fields saying which Go version introducd them.
|
||||
// Add comments to struct fields saying which Go version introduced them.
|
||||
if structName != "" {
|
||||
fieldSince := apiInfo.fieldSince[structName]
|
||||
typeSince := apiInfo.typeSince[structName]
|
||||
|
|
|
@ -189,7 +189,7 @@ It could run as a daemon on the user's machine, but there are a lot of issues wi
|
|||
Persistent disk caches are very expensive to maintain, and require solving a lot of extra problems.
|
||||
Although building the information required is expensive compared to the latencies required of the requests, it is fairly minor compared to the startup times of an editor, so it is expected that rebuilding the information when gopls is restarted will be acceptable.
|
||||
|
||||
The advantage gained from this is that gopls becomes stateless across restarts which means if it has issues or gets its state confused, a simle restart will often fix the problem.
|
||||
The advantage gained from this is that gopls becomes stateless across restarts which means if it has issues or gets its state confused, a simple restart will often fix the problem.
|
||||
It also means that when users report problems, the entire state of the on disk cache is not needed to diagnose and reproduce the issue.
|
||||
|
||||
### Communication: *stdin/stdout JSON*
|
||||
|
|
|
@ -265,7 +265,7 @@ var x = C // old type is int64, new is int
|
|||
var y int64 = x // fails with new: different types in assignment
|
||||
```
|
||||
|
||||
A change to the value of a constant can break compatiblity if the value is used
|
||||
A change to the value of a constant can break compatibility if the value is used
|
||||
in an array type:
|
||||
|
||||
```
|
||||
|
|
|
@ -586,7 +586,7 @@ type modTest struct {
|
|||
cleanup func()
|
||||
}
|
||||
|
||||
// setup builds a test enviroment from a txtar and supporting modules
|
||||
// setup builds a test environment from a txtar and supporting modules
|
||||
// in testdata/mod, along the lines of TestScript in cmd/go.
|
||||
func setup(t *testing.T, main, wd string) *modTest {
|
||||
t.Helper()
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"context"
|
||||
)
|
||||
|
||||
// Handler is the interface used to hook into the mesage handling of an rpc
|
||||
// Handler is the interface used to hook into the message handling of an rpc
|
||||
// connection.
|
||||
type Handler interface {
|
||||
// Deliver is invoked to handle incoming requests.
|
||||
|
|
|
@ -49,7 +49,7 @@ type Request struct {
|
|||
WireRequest
|
||||
}
|
||||
|
||||
// NewErrorf builds a Error struct for the suppied message and code.
|
||||
// NewErrorf builds a Error struct for the supplied message and code.
|
||||
// If args is not empty, message and args will be passed to Sprintf.
|
||||
func NewErrorf(code int64, format string, args ...interface{}) *Error {
|
||||
return &Error{
|
||||
|
|
|
@ -281,7 +281,7 @@ FindTo:
|
|||
//
|
||||
// If the previous token was a "." and we are looking at a "}",
|
||||
// the period is likely a dangling selector and needs a phantom
|
||||
// "_". Likewise if the currnet token is on a different line than
|
||||
// "_". Likewise if the current token is on a different line than
|
||||
// the period, the period is likely a dangling selector.
|
||||
if lastToken == token.PERIOD && (tkn == token.RBRACE || tok.Line(to) > tok.Line(last)) {
|
||||
// Insert phantom "_" selector after the dangling ".".
|
||||
|
|
|
@ -364,7 +364,7 @@ func (f *goFile) invalidateContent(ctx context.Context) {
|
|||
f.handle = nil
|
||||
}
|
||||
|
||||
// invalidateMeta invalides package metadata for all files in f's
|
||||
// invalidateMeta invalidates package metadata for all files in f's
|
||||
// package. This forces f's package's metadata to be reloaded next
|
||||
// time the package is checked.
|
||||
func (f *goFile) invalidateMeta(ctx context.Context) {
|
||||
|
|
|
@ -357,7 +357,7 @@ var memoryTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(`
|
|||
<tr><td class="label">Stack in use bytes</td><td class="value">{{fuint64 .StackInuse}}</td></tr>
|
||||
<tr><td class="label">Stack from system bytes</td><td class="value">{{fuint64 .StackSys}}</td></tr>
|
||||
<tr><td class="label">Bucket hash bytes</td><td class="value">{{fuint64 .BuckHashSys}}</td></tr>
|
||||
<tr><td class="label">GC metaata bytes</td><td class="value">{{fuint64 .GCSys}}</td></tr>
|
||||
<tr><td class="label">GC metadata bytes</td><td class="value">{{fuint64 .GCSys}}</td></tr>
|
||||
<tr><td class="label">Off heap bytes</td><td class="value">{{fuint64 .OtherSys}}</td></tr>
|
||||
</table>
|
||||
<h2>By size</h2>
|
||||
|
|
|
@ -139,7 +139,7 @@ func Operations(a, b []string) []*Op {
|
|||
|
||||
// backtrack uses the trace for the edit sequence computation and returns the
|
||||
// "snakes" that make up the solution. A "snake" is a single deletion or
|
||||
// insertion followed by zero or diagnonals.
|
||||
// insertion followed by zero or diagonals.
|
||||
func backtrack(trace [][]int, x, y, offset int) [][]int {
|
||||
snakes := make([][]int, len(trace))
|
||||
d := len(trace) - 1
|
||||
|
|
|
@ -114,7 +114,7 @@ func (m *Matcher) SetInput(input Input) {
|
|||
}
|
||||
|
||||
// Score returns the score returned by matching the candidate to the pattern.
|
||||
// This is not designed for parallel use. Multiple candidates must be scored sequentally.
|
||||
// This is not designed for parallel use. Multiple candidates must be scored sequentially.
|
||||
// Returns a score between 0 and 1 (0 - no match, 1 - perfect match).
|
||||
func (m *Matcher) Score(candidate string) float32 {
|
||||
if len(candidate) > MaxInputSize {
|
||||
|
|
|
@ -170,7 +170,7 @@ type completer struct {
|
|||
// surrounding describes the identifier surrounding the position.
|
||||
surrounding *Selection
|
||||
|
||||
// expectedType conains information about the type we expect the completion
|
||||
// expectedType contains information about the type we expect the completion
|
||||
// candidate to be. It will be the zero value if no information is available.
|
||||
expectedType typeInference
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ func (r *runner) Completion(t *testing.T, data tests.Completions, snippets tests
|
|||
}
|
||||
|
||||
// If deep completion is enabled, we need to use the fuzzy matcher to match
|
||||
// the code's behvaior.
|
||||
// the code's behavior.
|
||||
if deepComplete {
|
||||
if fuzzyMatcher != nil && fuzzyMatcher.Score(item.Label) < 0 {
|
||||
continue
|
||||
|
|
|
@ -160,7 +160,7 @@ type Session interface {
|
|||
// Cache returns the cache that created this session.
|
||||
Cache() Cache
|
||||
|
||||
// View returns a view with a mathing name, if the session has one.
|
||||
// View returns a view with a matching name, if the session has one.
|
||||
View(name string) View
|
||||
|
||||
// ViewOf returns a view corresponding to the given URI.
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
// Package memoize supports memoizing the return values of functions with
|
||||
// idempotent results that are expensive to compute.
|
||||
//
|
||||
// The memoizied result is returned again the next time the function is invoked.
|
||||
// The memoized result is returned again the next time the function is invoked.
|
||||
// To prevent excessive memory use, the return values are only remembered
|
||||
// for as long as they still have a user.
|
||||
//
|
||||
// To use this package, build a store and use it to aquire handles with the
|
||||
// To use this package, build a store and use it to acquire handles with the
|
||||
// Bind method.
|
||||
//
|
||||
package memoize
|
||||
|
@ -49,7 +49,7 @@ type Handle struct {
|
|||
type entry struct {
|
||||
noCopy
|
||||
key interface{}
|
||||
// mu contols access to the typ and ptr fields
|
||||
// mu controls access to the typ and ptr fields
|
||||
mu sync.Mutex
|
||||
// the calculated value, as stored in an interface{}
|
||||
typ, ptr uintptr
|
||||
|
|
|
@ -46,7 +46,7 @@ func TestFormat(t *testing.T) {
|
|||
for fi, format := range []string{"%v", "%#v", "%+v"} {
|
||||
expect := toPath(test[fi])
|
||||
if got := fmt.Sprintf(format, complete); got != expect {
|
||||
t.Errorf("printing completeted %q as %q got %q expected %q [%+v]", text, format, got, expect, spn)
|
||||
t.Errorf("printing completed %q as %q got %q expected %q [%+v]", text, format, got, expect, spn)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
//TODO: Do we need to do something more efficient than just store tags
|
||||
//TODO: directly on the context?
|
||||
|
||||
// Tagger is the interface to somthing that returns a Tag given a context.
|
||||
// Tagger is the interface to something that returns a Tag given a context.
|
||||
// Both Tag itself and Key support this interface, allowing methods that can
|
||||
// take either (and other implementations as well)
|
||||
type Tagger interface {
|
||||
|
|
|
@ -55,7 +55,7 @@ import (
|
|||
)
|
||||
|
||||
// A Constraint records the fact that the RHS type does and must
|
||||
// satisify the LHS type, which is an interface.
|
||||
// satisfy the LHS type, which is an interface.
|
||||
// The names are suggestive of an assignment statement LHS = RHS.
|
||||
type Constraint struct {
|
||||
LHS, RHS types.Type
|
||||
|
|
Загрузка…
Ссылка в новой задаче