diff --git a/cmd/guru/guru.go b/cmd/guru/guru.go index fdb13f929..18bb0840a 100644 --- a/cmd/guru/guru.go +++ b/cmd/guru/guru.go @@ -207,7 +207,7 @@ func pkgContainsFile(bp *build.Package, filename string) byte { return 0 // not found } -// ParseQueryPos parses the source query position pos and returns the +// parseQueryPos parses the source query position pos and returns the // AST node of the loaded program lprog that it identifies. // If needExact, it must identify a single AST subtree; // this is appropriate for queries that allow fairly arbitrary syntax, diff --git a/go/buildutil/util.go b/go/buildutil/util.go index d771b18e3..bee6390de 100644 --- a/go/buildutil/util.go +++ b/go/buildutil/util.go @@ -80,7 +80,7 @@ func ContainingPackage(ctxt *build.Context, dir, filename string) (*build.Packag // (go/build.Context defines these as methods, but does not export them.) -// hasSubdir calls ctxt.HasSubdir (if not nil) or else uses +// HasSubdir calls ctxt.HasSubdir (if not nil) or else uses // the local file system to answer the question. func HasSubdir(ctxt *build.Context, root, dir string) (rel string, ok bool) { if f := ctxt.HasSubdir; f != nil { diff --git a/go/ssa/dom.go b/go/ssa/dom.go index ce2473caf..66a2f5e6e 100644 --- a/go/ssa/dom.go +++ b/go/ssa/dom.go @@ -303,7 +303,7 @@ func sanityCheckDomTree(f *Function) { // Printing functions ---------------------------------------- -// printDomTree prints the dominator tree as text, using indentation. +// printDomTreeText prints the dominator tree as text, using indentation. func printDomTreeText(buf *bytes.Buffer, v *BasicBlock, indent int) { fmt.Fprintf(buf, "%*s%s\n", 4*indent, "", v) for _, child := range v.dom.children { diff --git a/gopls/internal/lsp/cache/load.go b/gopls/internal/lsp/cache/load.go index a77afaaac..37d42db1d 100644 --- a/gopls/internal/lsp/cache/load.go +++ b/gopls/internal/lsp/cache/load.go @@ -616,7 +616,7 @@ func containsOpenFileLocked(s *snapshot, m *KnownMetadata) bool { return false } -// containsFileInWorkspace reports whether m contains any file inside the +// containsFileInWorkspaceLocked reports whether m contains any file inside the // workspace of the snapshot s. // // s.mu must be held while calling this function. diff --git a/gopls/internal/lsp/lsppos/lsppos.go b/gopls/internal/lsp/lsppos/lsppos.go index 7db25fea9..425a4f74a 100644 --- a/gopls/internal/lsp/lsppos/lsppos.go +++ b/gopls/internal/lsp/lsppos/lsppos.go @@ -118,7 +118,7 @@ func (m *Mapper) Range(start, end int) (protocol.Range, error) { return protocol.Range{Start: startPos, End: endPos}, nil } -// UTF16Len returns the UTF-16 length of the UTF-8 encoded content, were it to +// UTF16len returns the UTF-16 length of the UTF-8 encoded content, were it to // be re-encoded as UTF-16. func UTF16len(buf []byte) int { // This function copies buf, but microbenchmarks showed it to be faster than diff --git a/gopls/internal/lsp/lsppos/token.go b/gopls/internal/lsp/lsppos/token.go index c1b726fe2..a42b5dad3 100644 --- a/gopls/internal/lsp/lsppos/token.go +++ b/gopls/internal/lsp/lsppos/token.go @@ -25,7 +25,7 @@ type TokenMapper struct { mapper *Mapper } -// NewMapper creates a new TokenMapper for the given content, using the +// NewTokenMapper creates a new TokenMapper for the given content, using the // provided file to compute offsets. func NewTokenMapper(content []byte, file *token.File) *TokenMapper { return &TokenMapper{ diff --git a/gopls/internal/lsp/lsprpc/autostart_default.go b/gopls/internal/lsp/lsprpc/autostart_default.go index 59a76dc2f..20b974728 100644 --- a/gopls/internal/lsp/lsprpc/autostart_default.go +++ b/gopls/internal/lsp/lsprpc/autostart_default.go @@ -24,7 +24,7 @@ func runRemote(cmd *exec.Cmd) error { return nil } -// autoNetworkAddress returns the default network and address for the +// autoNetworkAddressDefault returns the default network and address for the // automatically-started gopls remote. See autostart_posix.go for more // information. func autoNetworkAddressDefault(goplsPath, id string) (network string, address string) { diff --git a/gopls/internal/lsp/lsprpc/autostart_posix.go b/gopls/internal/lsp/lsprpc/autostart_posix.go index 948d44fce..90cc72ddf 100644 --- a/gopls/internal/lsp/lsprpc/autostart_posix.go +++ b/gopls/internal/lsp/lsprpc/autostart_posix.go @@ -33,7 +33,7 @@ func daemonizePosix(cmd *exec.Cmd) { } } -// autoNetworkAddress resolves an id on the 'auto' pseduo-network to a +// autoNetworkAddressPosix resolves an id on the 'auto' pseduo-network to a // real network and address. On unix, this uses unix domain sockets. func autoNetworkAddressPosix(goplsPath, id string) (network string, address string) { // Especially when doing local development or testing, it's important that diff --git a/gopls/internal/lsp/source/extract.go b/gopls/internal/lsp/source/extract.go index 488305ac0..7f29d45ba 100644 --- a/gopls/internal/lsp/source/extract.go +++ b/gopls/internal/lsp/source/extract.go @@ -651,7 +651,7 @@ func extractFunctionMethod(fset *token.FileSet, rng span.Range, src []byte, file }, nil } -// adjustRangeForCommentsAndWhitespace adjusts the given range to exclude unnecessary leading or +// adjustRangeForCommentsAndWhiteSpace adjusts the given range to exclude unnecessary leading or // trailing whitespace characters from selection as well as leading or trailing comments. // In the following example, each line of the if statement is indented once. There are also two // extra spaces after the sclosing bracket before the line break and a comment. @@ -1119,7 +1119,7 @@ func varOverridden(info *types.Info, firstUse *ast.Ident, obj types.Object, isFr return isOverriden } -// parseExtraction generates an AST file from the given text. We then return the portion of the +// parseBlockStmt generates an AST file from the given text. We then return the portion of the // file that represents the text. func parseBlockStmt(fset *token.FileSet, src []byte) (*ast.BlockStmt, error) { text := "package main\nfunc _() { " + string(src) + " }" diff --git a/gopls/internal/lsp/source/format.go b/gopls/internal/lsp/source/format.go index c6e70efce..2c9574a5f 100644 --- a/gopls/internal/lsp/source/format.go +++ b/gopls/internal/lsp/source/format.go @@ -354,7 +354,7 @@ func ToProtocolEdits(m *protocol.ColumnMapper, edits []diff.Edit) ([]protocol.Te return result, nil } -// ToProtocolEdits converts LSP TextEdits to diff.Edits. +// FromProtocolEdits converts LSP TextEdits to diff.Edits. // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textEditArray func FromProtocolEdits(m *protocol.ColumnMapper, edits []protocol.TextEdit) ([]diff.Edit, error) { if edits == nil { diff --git a/gopls/internal/lsp/source/rename.go b/gopls/internal/lsp/source/rename.go index 495791f95..c926dedcf 100644 --- a/gopls/internal/lsp/source/rename.go +++ b/gopls/internal/lsp/source/rename.go @@ -276,7 +276,7 @@ func computeImportRenamingEdits(ctx context.Context, s Snapshot, renamingPkg Pac return result, nil } -// computeImportRenamingEdits computes all edits to files within the renming packages. +// computePackageNameRenamingEdits computes all edits to files within the renming packages. func computePackageNameRenamingEdits(renamingPkg Package, newName string) (map[span.URI][]protocol.TextEdit, error) { result := make(map[span.URI][]protocol.TextEdit) // Rename internal references to the package in the renaming package. diff --git a/gopls/internal/span/uri.go b/gopls/internal/span/uri.go index ce874e703..adcc54a77 100644 --- a/gopls/internal/span/uri.go +++ b/gopls/internal/span/uri.go @@ -185,7 +185,7 @@ func isWindowsDrivePath(path string) bool { return unicode.IsLetter(rune(path[0])) && path[1] == ':' } -// isWindowsDriveURI returns true if the file URI is of the format used by +// isWindowsDriveURIPath returns true if the file URI is of the format used by // Windows URIs. The url.Parse package does not specially handle Windows paths // (see golang/go#6027), so we check if the URI path has a drive prefix (e.g. "/C:"). func isWindowsDriveURIPath(uri string) bool { diff --git a/internal/diff/ndiff.go b/internal/diff/ndiff.go index 722b50c98..4dd83237a 100644 --- a/internal/diff/ndiff.go +++ b/internal/diff/ndiff.go @@ -91,7 +91,7 @@ func runesLen(runes []rune) (len int) { return len } -// isASCII reports whether s contains only ASCII. +// stringIsASCII reports whether s contains only ASCII. // TODO(adonovan): combine when x/tools allows generics. func stringIsASCII(s string) bool { for i := 0; i < len(s); i++ { diff --git a/present/args.go b/present/args.go index d63196e02..b4f7503b6 100644 --- a/present/args.go +++ b/present/args.go @@ -18,7 +18,7 @@ import ( // regular expressions. That is the only change to the code from codewalk.go. // See http://9p.io/sys/doc/sam/sam.html Table II for details on the syntax. -// addrToByte evaluates the given address starting at offset start in data. +// addrToByteRange evaluates the given address starting at offset start in data. // It returns the lo and hi byte offset of the matched region within data. func addrToByteRange(addr string, start int, data []byte) (lo, hi int, err error) { if addr == "" {