diff --git a/cmd/splitdwarf/splitdwarf.go b/cmd/splitdwarf/splitdwarf.go index a13b9f316a..1251e74f69 100644 --- a/cmd/splitdwarf/splitdwarf.go +++ b/cmd/splitdwarf/splitdwarf.go @@ -94,7 +94,7 @@ for input_exe need to allow writing. // IndSym Offset = file offset (within link edit section) of 4-byte indices within symtab. // // Section __TEXT.__symbol_stub1. - // Offset and size (Reserved2) locate and describe a table for thios section. + // Offset and size (Reserved2) locate and describe a table for this section. // Symbols beginning at IndirectSymIndex (Reserved1) (see LC_DYSYMTAB.IndSymOffset) refer to this table. // (These table entries are apparently PLTs [Procedure Linkage Table/Trampoline]) // diff --git a/go/analysis/internal/checker/checker.go b/go/analysis/internal/checker/checker.go index e405a2ae11..090e96c0d7 100644 --- a/go/analysis/internal/checker/checker.go +++ b/go/analysis/internal/checker/checker.go @@ -826,7 +826,7 @@ func codeFact(fact analysis.Fact) (analysis.Fact, error) { // exportedFrom reports whether obj may be visible to a package that imports pkg. // This includes not just the exported members of pkg, but also unexported -// constants, types, fields, and methods, perhaps belonging to oether packages, +// constants, types, fields, and methods, perhaps belonging to other packages, // that find there way into the API. // This is an overapproximation of the more accurate approach used by // gc export data, which walks the type graph, but it's much simpler. diff --git a/go/analysis/passes/sigchanyzer/sigchanyzer.go b/go/analysis/passes/sigchanyzer/sigchanyzer.go index 0d6c8ebf16..c490a84ea7 100644 --- a/go/analysis/passes/sigchanyzer/sigchanyzer.go +++ b/go/analysis/passes/sigchanyzer/sigchanyzer.go @@ -50,7 +50,7 @@ func run(pass *analysis.Pass) (interface{}, error) { } case *ast.CallExpr: // Only signal.Notify(make(chan os.Signal), os.Interrupt) is safe, - // conservatively treate others as not safe, see golang/go#45043 + // conservatively treat others as not safe, see golang/go#45043 if isBuiltinMake(pass.TypesInfo, arg) { return } diff --git a/go/pointer/analysis.go b/go/pointer/analysis.go index 0abb04dd80..0ee0b05646 100644 --- a/go/pointer/analysis.go +++ b/go/pointer/analysis.go @@ -59,8 +59,8 @@ type object struct { // // ssa.Value for an object allocated by an SSA operation. // types.Type for an rtype instance object or *rtype-tagged object. - // string for an instrinsic object, e.g. the array behind os.Args. - // nil for an object allocated by an instrinsic. + // string for an intrinsic object, e.g. the array behind os.Args. + // nil for an object allocated by an intrinsic. // (cgn provides the identity of the intrinsic.) data interface{} diff --git a/internal/event/export/trace.go b/internal/event/export/trace.go index 1a99482f1d..79aebbaca0 100644 --- a/internal/event/export/trace.go +++ b/internal/event/export/trace.go @@ -90,7 +90,7 @@ func (s *SpanContext) Format(f fmt.State, r rune) { } func (s *Span) Start() core.Event { - // start never changes after construction, so we dont need to hold the mutex + // start never changes after construction, so we don't need to hold the mutex return s.start } diff --git a/internal/jsonrpc2/wire.go b/internal/jsonrpc2/wire.go index d805f57937..ac39f1601f 100644 --- a/internal/jsonrpc2/wire.go +++ b/internal/jsonrpc2/wire.go @@ -33,7 +33,7 @@ var ( ErrServerOverloaded = NewError(-32000, "JSON RPC overloaded") ) -// wireRequest is sent to a server to represent a Call or Notify operaton. +// wireRequest is sent to a server to represent a Call or Notify operation. type wireRequest struct { // VersionTag is always encoded as the string "2.0" VersionTag wireVersionTag `json:"jsonrpc"` diff --git a/internal/jsonrpc2_v2/net.go b/internal/jsonrpc2_v2/net.go index 4f20825999..f1e2b0c7b3 100644 --- a/internal/jsonrpc2_v2/net.go +++ b/internal/jsonrpc2_v2/net.go @@ -81,7 +81,7 @@ func (n *netDialer) Dial(ctx context.Context) (io.ReadWriteCloser, error) { } // NetPipeListener returns a new Listener that listens using net.Pipe. -// It is only possibly to connect to it using the Dialier returned by the +// It is only possibly to connect to it using the Dialer returned by the // Dialer method, each call to that method will generate a new pipe the other // side of which will be returned from the Accept call. func NetPipeListener(ctx context.Context) (Listener, error) { diff --git a/internal/lsp/analysis/fillreturns/fillreturns.go b/internal/lsp/analysis/fillreturns/fillreturns.go index 4607f37c09..3299f74e98 100644 --- a/internal/lsp/analysis/fillreturns/fillreturns.go +++ b/internal/lsp/analysis/fillreturns/fillreturns.go @@ -188,8 +188,8 @@ outer: if !ok { return nil, fmt.Errorf("invalid return type: %v", retTyp) } - // Find the identifer whose name is most similar to the return type. - // If we do not find any identifer that matches the pattern, + // Find the identifier whose name is most similar to the return type. + // If we do not find any identifier that matches the pattern, // generate a zero value. value := analysisinternal.FindBestMatch(retTyp.String(), idents) if value == nil { diff --git a/internal/lsp/analysis/fillstruct/fillstruct.go b/internal/lsp/analysis/fillstruct/fillstruct.go index a4dd8ccb8b..8523ae7fdd 100644 --- a/internal/lsp/analysis/fillstruct/fillstruct.go +++ b/internal/lsp/analysis/fillstruct/fillstruct.go @@ -251,8 +251,8 @@ func SuggestedFix(fset *token.FileSet, rng span.Range, content []byte, file *ast return nil, fmt.Errorf("invalid struct field type: %v", fieldTyp) } - // Find the identifer whose name is most similar to the name of the field's key. - // If we do not find any identifer that matches the pattern, generate a new value. + // Find the identifier whose name is most similar to the name of the field's key. + // If we do not find any identifier that matches the pattern, generate a new value. // NOTE: We currently match on the name of the field key rather than the field type. value := analysisinternal.FindBestMatch(obj.Field(i).Name(), idents) if value == nil { diff --git a/internal/lsp/cache/analysis.go b/internal/lsp/cache/analysis.go index d66a3ed37c..b5aebcc3cf 100644 --- a/internal/lsp/cache/analysis.go +++ b/internal/lsp/cache/analysis.go @@ -367,7 +367,7 @@ func runAnalysis(ctx context.Context, snapshot *snapshot, analyzer *analysis.Ana // exportedFrom reports whether obj may be visible to a package that imports pkg. // This includes not just the exported members of pkg, but also unexported -// constants, types, fields, and methods, perhaps belonging to oether packages, +// constants, types, fields, and methods, perhaps belonging to other packages, // that find there way into the API. // This is an overapproximation of the more accurate approach used by // gc export data, which walks the type graph, but it's much simpler. diff --git a/internal/lsp/cache/load.go b/internal/lsp/cache/load.go index 17b7acae03..2095dc61b1 100644 --- a/internal/lsp/cache/load.go +++ b/internal/lsp/cache/load.go @@ -364,7 +364,7 @@ func getWorkspaceDir(ctx context.Context, h *memoize.Handle, g *memoize.Generati } // setMetadataLocked extracts metadata from pkg and records it in s. It -// recurses through pkg.Imports to ensure that metadata exists for all +// recurs through pkg.Imports to ensure that metadata exists for all // dependencies. func (s *snapshot) setMetadataLocked(ctx context.Context, pkgPath PackagePath, pkg *packages.Package, cfg *packages.Config, query []string, seen map[PackageID]struct{}) (*Metadata, error) { id := PackageID(pkg.ID) diff --git a/internal/lsp/cache/workspace.go b/internal/lsp/cache/workspace.go index 5d62d66913..b9731c3808 100644 --- a/internal/lsp/cache/workspace.go +++ b/internal/lsp/cache/workspace.go @@ -272,7 +272,7 @@ func (w *workspace) dirs(ctx context.Context, fs source.FileSource) []span.URI { // reload of metadata (for example, unsaved changes to a go.mod or go.sum // file). func (w *workspace) invalidate(ctx context.Context, changes map[span.URI]*fileChange, fs source.FileSource) (_ *workspace, changed, reload bool) { - // Prevent races to w.modFile or w.wsDirs below, if wmhas not yet been built. + // Prevent races to w.modFile or w.wsDirs below, if w has not yet been built. w.buildMu.Lock() defer w.buildMu.Unlock() diff --git a/internal/lsp/lsprpc/lsprpc.go b/internal/lsp/lsprpc/lsprpc.go index 478d362e02..df2138348d 100644 --- a/internal/lsp/lsprpc/lsprpc.go +++ b/internal/lsp/lsprpc/lsprpc.go @@ -319,7 +319,7 @@ func (f *Forwarder) handler(handler jsonrpc2.Handler) jsonrpc2.Handler { // any environment variables output by `go env` and not already present in the // request. // -// It returns an error if r is not an initialize requst, or is otherwise +// It returns an error if r is not an initialize request, or is otherwise // malformed. func addGoEnvToInitializeRequest(ctx context.Context, r jsonrpc2.Request) (jsonrpc2.Request, error) { var params protocol.ParamInitialize diff --git a/internal/lsp/regtest/doc.go b/internal/lsp/regtest/doc.go index 3994e54cb6..bdc4ad6039 100644 --- a/internal/lsp/regtest/doc.go +++ b/internal/lsp/regtest/doc.go @@ -26,7 +26,7 @@ // are conditions that we expect to be met (or not to be met) at some point // after performing the interactions in the test. This is necessary because the // LSP is by construction asynchronous: both client and server can send -// eachother notifications without formal acknowledgement that they have been +// each other notifications without formal acknowledgement that they have been // fully processed. // // Simple Expectations may be combined to match specific conditions reported by diff --git a/internal/lsp/regtest/expectation.go b/internal/lsp/regtest/expectation.go index 5cf2b6c154..50602ce6b6 100644 --- a/internal/lsp/regtest/expectation.go +++ b/internal/lsp/regtest/expectation.go @@ -72,7 +72,7 @@ func (e SimpleExpectation) Check(s State) Verdict { return e.check(s) } -// Description returns e.descriptin. +// Description returns e.description. func (e SimpleExpectation) Description() string { return e.description } diff --git a/internal/lsp/source/call_hierarchy.go b/internal/lsp/source/call_hierarchy.go index 991c30aebd..212e648e5f 100644 --- a/internal/lsp/source/call_hierarchy.go +++ b/internal/lsp/source/call_hierarchy.go @@ -253,7 +253,7 @@ func collectCallExpressions(fset *token.FileSet, mapper *protocol.ColumnMapper, // Calls to the same function are assigned to the same declaration. func toProtocolOutgoingCalls(ctx context.Context, snapshot Snapshot, fh FileHandle, callRanges []protocol.Range) ([]protocol.CallHierarchyOutgoingCall, error) { // Multiple calls could be made to the same function, defined by "same declaration - // AST node & same idenfitier name" to provide a unique identifier key even when + // AST node & same identifier name" to provide a unique identifier key even when // the func is declared in a struct or interface. type key struct { decl ast.Node diff --git a/internal/lsp/source/completion/completion.go b/internal/lsp/source/completion/completion.go index 60c404dc5f..45bb6db0c1 100644 --- a/internal/lsp/source/completion/completion.go +++ b/internal/lsp/source/completion/completion.go @@ -372,7 +372,7 @@ type candidate struct { pathInvokeMask uint16 // mods contains modifications that should be applied to the - // candidate when inserted. For example, "foo" may be insterted as + // candidate when inserted. For example, "foo" may be inserted as // "*foo" or "foo()". mods []typeModKind @@ -654,7 +654,7 @@ func (c *completer) collectCompletions(ctx context.Context) error { // synthesizes an *ast.Ident to allow completion in the face of // certain syntax errors. func (c *completer) containingIdent(src []byte) *ast.Ident { - // In the normal case, our leaf AST node is the identifer being completed. + // In the normal case, our leaf AST node is the identifier being completed. if ident, ok := c.path[0].(*ast.Ident); ok { return ident } @@ -1981,7 +1981,7 @@ Nodes: inf.assignees = append(inf.assignees, c.pkg.GetTypesInfo().TypeOf(lhs)) } } else { - // Otherwse, record our single assignee, even if its type is + // Otherwise, record our single assignee, even if its type is // not available. We use this info to downrank functions // with the wrong number of result values. inf.assignees = append(inf.assignees, c.pkg.GetTypesInfo().TypeOf(node.Lhs[i])) @@ -2771,7 +2771,7 @@ func (ci *candidateInference) assigneesMatch(cand *candidate, sig *types.Signatu } // Don't prefer completing into func(...interface{}) calls since all - // functions wouuld match. + // functions would match. if ci.variadicAssignees && len(ci.assignees) == 1 && isEmptyInterface(deslice(ci.assignees[0])) { return false } diff --git a/internal/lsp/source/completion/deep_completion.go b/internal/lsp/source/completion/deep_completion.go index a13d807d4f..a72d561910 100644 --- a/internal/lsp/source/completion/deep_completion.go +++ b/internal/lsp/source/completion/deep_completion.go @@ -19,7 +19,7 @@ const MaxDeepCompletions = 3 // "deep completion" refers to searching into objects' fields and methods to // find more completion candidates. type deepCompletionState struct { - // enabled indicates wether deep completion is permitted. + // enabled indicates whether deep completion is permitted. enabled bool // queueClosed is used to disable adding new sub-fields to search queue diff --git a/internal/lsp/source/completion/printf.go b/internal/lsp/source/completion/printf.go index ce74af53b8..4320117554 100644 --- a/internal/lsp/source/completion/printf.go +++ b/internal/lsp/source/completion/printf.go @@ -156,7 +156,7 @@ func parsePrintfVerb(f string, prevIdx int) (string, []formatOperand) { case 'w': addVerb(kindError) case '+', '-', '#', ' ', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - // Flag or numeric width/precicision value. + // Flag or numeric width/precision value. continue default: // Assume unrecognized rune is a custom fmt.Formatter verb. diff --git a/internal/lsp/source/extract.go b/internal/lsp/source/extract.go index 43b414add9..0d6880014b 100644 --- a/internal/lsp/source/extract.go +++ b/internal/lsp/source/extract.go @@ -145,7 +145,7 @@ func calculateIndentation(content []byte, tok *token.File, insertBeforeStmt ast. return string(content[lineOffset:stmtOffset]), nil } -// generateAvailableIdentifier adjusts the new function name until there are no collisons in scope. +// generateAvailableIdentifier adjusts the new function name until there are no collisions in scope. // Possible collisions include other function and variable names. Returns the next index to check for prefix. func generateAvailableIdentifier(pos token.Pos, file *ast.File, path []ast.Node, info *types.Info, prefix string, idx int) (string, int) { scopes := CollectScopes(info, path, pos) @@ -290,7 +290,7 @@ func extractFunctionMethod(fset *token.FileSet, rng span.Range, src []byte, file uninitialized []types.Object // vars we will need to initialize before the call ) - // Avoid duplicates while traversing vars and uninitialzed. + // Avoid duplicates while traversing vars and uninitialized. seenVars := make(map[types.Object]ast.Expr) seenUninitialized := make(map[types.Object]struct{}) @@ -523,7 +523,7 @@ func extractFunctionMethod(fset *token.FileSet, rng span.Range, src []byte, file // Construct the appropriate call to the extracted function. // We must meet two conditions to use ":=" instead of '='. (1) there must be at least - // one variable on the lhs that is uninitailized (non-free) prior to the assignment. + // one variable on the lhs that is uninitialized (non-free) prior to the assignment. // (2) all of the initialized (free) variables on the lhs must be able to be redefined. sym := token.ASSIGN canDefineCount := len(uninitialized) + canRedefineCount @@ -567,7 +567,7 @@ func extractFunctionMethod(fset *token.FileSet, rng span.Range, src []byte, file // Create variable declarations for any identifiers that need to be initialized prior to // calling the extracted function. We do not manually initialize variables if every return - // value is unitialized. We can use := to initialize the variables in this situation. + // value is uninitialized. We can use := to initialize the variables in this situation. var declarations []ast.Stmt if canDefineCount != len(returns) { declarations = initializeVars(uninitialized, retVars, seenUninitialized, seenVars) diff --git a/internal/lsp/source/highlight.go b/internal/lsp/source/highlight.go index 7cdb484a85..66a8e9b627 100644 --- a/internal/lsp/source/highlight.go +++ b/internal/lsp/source/highlight.go @@ -136,7 +136,7 @@ Outer: // If cursor is in a key: value expr, we don't want control flow highlighting return case *ast.CallExpr: - // If cusor is an arg in a callExpr, we don't want control flow highlighting. + // If cursor is an arg in a callExpr, we don't want control flow highlighting. if i > 0 { for _, arg := range node.Args { if arg == path[i-1] { diff --git a/internal/lsp/source/identifier.go b/internal/lsp/source/identifier.go index bf4941f189..09c8493ed9 100644 --- a/internal/lsp/source/identifier.go +++ b/internal/lsp/source/identifier.go @@ -116,7 +116,7 @@ func Identifier(ctx context.Context, snapshot Snapshot, fh FileHandle, pos proto return nil, findErr } -// ErrNoIdentFound is error returned when no identifer is found at a particular position +// ErrNoIdentFound is error returned when no identifier is found at a particular position var ErrNoIdentFound = errors.New("no identifier found") func findIdentifier(ctx context.Context, snapshot Snapshot, pkg Package, pgf *ParsedGoFile, pos token.Pos) (*IdentifierInfo, error) { diff --git a/internal/lsp/source/known_packages.go b/internal/lsp/source/known_packages.go index 49ede162b3..fd83da002a 100644 --- a/internal/lsp/source/known_packages.go +++ b/internal/lsp/source/known_packages.go @@ -84,7 +84,7 @@ func KnownPackages(ctx context.Context, snapshot Snapshot, fh VersionedFileHandl }, "", pgf.URI.Filename(), pkg.GetTypes().Name(), o.Env) }) if err != nil { - // if an error occurred, we stil have a decent list we can + // if an error occurred, we still have a decent list we can // show to the user through snapshot.CachedImportPaths event.Error(ctx, "imports.GetAllCandidates", err) } diff --git a/internal/lsp/source/options.go b/internal/lsp/source/options.go index 8e262c63b2..1d85636ca4 100644 --- a/internal/lsp/source/options.go +++ b/internal/lsp/source/options.go @@ -690,7 +690,7 @@ func (o *Options) ForClientCapabilities(caps protocol.ClientCapabilities) { // Check if the client supports diagnostic related information. o.RelatedInformationSupported = caps.TextDocument.PublishDiagnostics.RelatedInformation - // Check if the client completion support incliudes tags (preferred) or deprecation + // Check if the client completion support includes tags (preferred) or deprecation if caps.TextDocument.Completion.CompletionItem.TagSupport.ValueSet != nil { o.CompletionTags = true } else if caps.TextDocument.Completion.CompletionItem.DeprecatedSupport { diff --git a/internal/lsp/source/rename.go b/internal/lsp/source/rename.go index 2ad5d265fc..7fce067cb8 100644 --- a/internal/lsp/source/rename.go +++ b/internal/lsp/source/rename.go @@ -32,7 +32,7 @@ type renamer struct { errors string from, to string satisfyConstraints map[satisfy.Constraint]bool - packages map[*types.Package]Package // may include additional packages that are a rdep of pkg + packages map[*types.Package]Package // may include additional packages that are a dep of pkg msets typeutil.MethodSetCache changeMethods bool } diff --git a/internal/lsp/source/view.go b/internal/lsp/source/view.go index 4d7d411e08..d263c1a9bf 100644 --- a/internal/lsp/source/view.go +++ b/internal/lsp/source/view.go @@ -677,7 +677,7 @@ var ( // The major version is not included, as that depends on the module path. // // If workspace module A is dependent on workspace module B, we need our -// nonexistant version to be greater than the version A mentions. +// nonexistent version to be greater than the version A mentions. // Otherwise, the go command will try to update to that version. Use a very // high minor version to make that more likely. const workspaceModuleVersion = ".9999999.0-goplsworkspace" diff --git a/internal/lsp/template/implementations.go b/internal/lsp/template/implementations.go index 1de988871c..cda3e7ef0a 100644 --- a/internal/lsp/template/implementations.go +++ b/internal/lsp/template/implementations.go @@ -71,7 +71,7 @@ func Diagnose(f source.VersionedFileHandle) []*source.Diagnostic { // Definition finds the definitions of the symbol at loc. It // does not understand scoping (if any) in templates. This code is -// for defintions, type definitions, and implementations. +// for definitions, type definitions, and implementations. // Results only for variables and templates. func Definition(snapshot source.Snapshot, fh source.VersionedFileHandle, loc protocol.Position) ([]protocol.Location, error) { x, _, err := symAtPosition(fh, loc) diff --git a/internal/lsp/template/parse.go b/internal/lsp/template/parse.go index 194eeb3f5e..e0cfee5021 100644 --- a/internal/lsp/template/parse.go +++ b/internal/lsp/template/parse.go @@ -9,7 +9,7 @@ package template // this may be a bad choice for projects with lots of template files. // This file contains the parsing code, some debugging printing, and -// implementations for Diagnose, Definition, HJover, References +// implementations for Diagnose, Definition, Hover, References import ( "bytes"