all: merge master (81c7dc4) into gopls-release-branch.0.9

Also add a replace to gopls/go.mod.

For golang/go#54294


- gopls/go.mod
- gopls/go.sum

Merge List:

+ 2022-08-04 81c7dc4e4 internal/lsp: polish vulncheck progress messages
+ 2022-08-04 af2a0a816 internal/lsp: use exec.CommandContext when running vulncheck
+ 2022-08-04 3519aa25b internal/lsp/cmd: remove unused Env from pkgLoadConfig
+ 2022-08-04 6c27717f2 internal/lsp/mod/code_lens: add "run govulncheck" codelens
+ 2022-08-04 763f65c3d gopls/internal/regtest/misc: simplify shared edit tests
+ 2022-08-04 fc3b24a45 go/internal/gcimporter: rewrite interface receiver parameters
+ 2022-08-04 b5fd08821 internal/lsp/command: replace VulncheckArgs Dir with URI
+ 2022-08-04 99fd76f9c internal/lsp/cache: delete KnownMetadata.PkgFilesChanged
+ 2022-08-04 01c9ff053 internal/lsp/cache: invalid packages should not be workspace packages
+ 2022-08-04 bd68922a8 internal/lsp: new options to disable certain kinds of semantic tokens
+ 2022-08-04 bceee4b05 internal/lsp/command: let RunVulncheckExp call gopls vulncheck
+ 2022-08-04 3e0a5031e internal/lsp: use directoryFilters in import scanning
+ 2022-08-04 87f47bbfb gopls/internal/regtest/bench: refactor and improve benchmarks
+ 2022-08-03 8b9a1fbdf go/callgraph/vta: do not assume that recovers cannot be deferred
+ 2022-08-03 371fc67d3 go/tools: add check for time formats with 2006-02-01
+ 2022-08-03 d08f5dc9f gopls/internal/regtest: unskip all of TestModFileModification
+ 2022-08-03 ddb90ecd3 internal/lsp/cache: fix data races to view.options
+ 2022-08-02 0d04f65da internal/lsp: re-send diagnostics on file events
+ 2022-08-02 d025cced8 internal/lsp/source: don't crash requesting gc_details for an empty file
+ 2022-08-02 10cb4353f internal/lsp/regtest: improvements for shared execution modes
+ 2022-08-02 4d0b38345 internal/lsp/regtest: minor cleanup for magic regtest envvar
+ 2022-08-02 310ea71b7 gopls/internal/regtest: add a test that ignoring a file resolves errors
+ 2022-08-01 21861e6be gopls/internal/regtest/bench: put feature benchmarks in their own file
+ 2022-08-01 c7f11917c go/internal/gcimporter: set underlying types in proper order; flatten imports
+ 2022-08-01 bd3f52477 internal/lsp: rename all the package names in the renamed package
+ 2022-08-01 9f6568509 internal/lsp/source: enable the new diff with allExperiments
+ 2022-07-29 9580c84d5 internal/lsp: Check if user's editor support rename operation
+ 2022-07-29 f560bc877 internal/lsp/cache: don't set context cancellation as a critical err
+ 2022-07-28 8ea568798 internal/lsp/regtest: remove arbitrary timeout for closing the editor
+ 2022-07-28 d01bb2ff9 internal/lsp/source: document the handling of GOPRIVATE for linkTarget
+ 2022-07-28 98bfcd1be internal/memoize: fix race in Store.Promise
+ 2022-07-27 e02e98a03 internal/lsp/cache: allow network whenever reloading the workspace
+ 2022-07-27 b52794acc internal/lsp/cache: simplify snapshot.Clone reinitialization logic
+ 2022-07-27 f1bb5ca08 internal/lsp/cache: report a critical error when is invalid
+ 2022-07-27 b3b5c13b2 internal/lsp/cache: invalidate packages with missing deps when files are added
+ 2022-07-26 39a4e3647 internal/lsp/regtest: only run /default tests with -short
+ 2022-07-26 f157068c1 internal/lsp/regtest: allow sharing memoized results across regtests
+ 2022-07-26 8ccb25c9a internal/lsp: treat struct tags as string type
+ 2022-07-26 6c8a6c409 internal/lsp: suppress parameter hint when argument matches parameter
+ 2022-07-26 c83f42da7 internal/lsp: update inlay hints documentation to include go snippets
+ 2022-07-26 8b47d4e18 all: update dependencies
+ 2022-07-26 76004542d gopls: update dependencies
+ 2022-07-25 2a6393fe5 internal/lsp: Refactor to share logic with rename
+ 2022-07-25 4375b29f4 cmd/auth/cookieauth: delete unreachable os.Exit
+ 2022-07-25 005c07ac5 gopls/internal/vulncheck: adjust logging
+ 2022-07-25 04bd08781 internal/lsp: enable fillstruct for generics
+ 2022-07-25 6ec939a61 internal/span: fix incorrect bounds check in ToOffset
+ 2022-07-25 178fdf98d gopls/internal/regtest: unskip Test_Issue38211
+ 2022-07-25 1cfe623eb gopls/internal/regtest: unskip TestQuickFixEmptyFiles
+ 2022-07-24 3d474c890 internal/lsp/diff: new diff implementation to replace go-diff
+ 2022-07-22 a2a24778b gopls/internal/regtest: externalize shouldLoad tracking
+ 2022-07-22 7b605f471 gopls/internal/vulncheck: pass go version to vulncheck config
+ 2022-07-22 126ef8f86 gopls/internal/govulncheck: sync x/vuln@b9a3ad9
+ 2022-07-22 a732e45cc gopls: update
+ 2022-07-22 980cbfeac A+C: delete AUTHORS and CONTRIBUTORS
+ 2022-07-20 ec1f92440 internal/lsp: add check for nil results to fillreturns
+ 2022-07-19 79f3242e4 godoc: support go1.19 doc comment syntax
+ 2022-07-18 2957e9da5 go/callgraph/vta: use types.IsInterface instead of our own isInterface
+ 2022-07-18 2eaea8659 go/callgraph/vta: do not include interface types during propagation
+ 2022-07-18 dc45e742f internal/lsp: Update FilterDisallow to support matching directories at arbitrary depth.
+ 2022-07-15 ce6ce7662 internal/lsp/regtest: increase the time allowed for shutdown
+ 2022-07-15 32129bf2c go/internal/gcimporter: adjust importer to match compiler importer
+ 2022-07-15 22d149443 internal/gcimporter: add support for reading unified IR export data
+ 2022-07-15 c3af7c2fa internal/lsp/cache: delete workspacePackageHandles (dead code)
+ 2022-07-15 1a4e02fee internal/lsp/analysis/unusedvariable: add analyzer
+ 2022-07-14 db8f89b39 internal/memoize: rename Handle to Promise
+ 2022-07-13 a7c53b59a internal/analysisinternal: move FindBestMatch to internal/lsp/fuzzy
+ 2022-07-13 9b6c01892 internal/lsp/cache: don't trim unexported struct fields
+ 2022-07-13 85173cc4b internal/lsp/cache: follow usual structure for packages, analysis maps
+ 2022-07-13 b2eae7626 internal/lsp/cache: simplify modwhy cache
+ 2022-07-13 dcb576d3b internal/lsp/cache: simplify modtidy
+ 2022-07-13 b230791f2 internal/lsp/cache: move PosTo{Decl,Field} out of cache
+ 2022-07-12 8730184ef internal/lsp/fake: retry spurious file lock errors on windows
+ 2022-07-12 459e2b88f internal/lsp/progress: actually close over Context in WorkDoneWriter
+ 2022-07-12 7c06b01db go/callgraph/vta: remove interprocedural flows for receiver objects
+ 2022-07-12 6e6f3131e internal/lsp/regtest: simplify, consolidate, and document settings
+ 2022-07-12 3db2cdc06 internal/lsp: wait for ongoing work to complete during server shutdown
+ 2022-07-12 a5adb0f2c internal/lsp/cache: use mod=readonly for process env funcs
+ 2022-07-12 a79ee0f0f Revert "Revert "internal/lsp/cache: don't pin a snapshot to view.importsState"
+ 2022-07-12 bc957ec62 internal/lsp/source: use token.File-agnostic positions to dedupe refs
+ 2022-07-11 b6e495100 Revert "internal/lsp/cache: don't pin a snapshot to view.importsState"
+ 2022-07-11 71dc5e295 internal/lsp/cache: make snapshot reference counting uniform
+ 2022-07-11 42457a544 internal/lsp/cache: don't pin a snapshot to view.importsState
+ 2022-07-08 d6c099e3c internal/memoize: document stateIdle, RefCounted
+ 2022-07-08 53ead67a9 internal/memoize: delete Generation and Bind
+ 2022-07-08 874617721 internal/lsp/cache: simplify ParseGo
+ 2022-07-08 9c2a5567e internal/lsp/cache: fail addPackageHandle if metadata is stale
+ 2022-07-07 1dfab61a4 internal/lsp/cache: use GetHandle not Bind for 5 URI-keyed maps
+ 2022-07-07 2aef121b8 internal/lsp: consolidate .go/go.mod link logic
+ 2022-07-07 8184d1ff7 internal/lsp/cache: use GetHandle not Bind in astCacheData
+ 2022-07-06 36430f4b3 internal/lsp/cache: use GetHandle not Bind for actions
+ 2022-07-06 b929f3bf4 internal/span: make NewRange accept File, not FileSet
+ 2022-07-06 d69bac6d8 internal/lsp/cache: cache isActiveLocked calculation across snapshots
+ 2022-07-05 afa4a9562 internal/lsp/cache: persist known subdirs
+ 2022-07-01 698251aaa internal/lsp/cache: sort Metadata.Deps, for determinism
+ 2022-07-01 f79f3aac1 internal/lsp/cache: clarify buildPackageHandle
+ 2022-07-01 e92a18fd1 internal/lsp/lsppos: reduce allocations in NewMapper
+ 2022-07-01 f487f3623 internal/lsp/source: reduce allocation in workspace-symbols
+ 2022-07-01 7b04e8b59 internal/persistent: no-op deletion from map does not allocate
+ 2022-07-01 f042799df internal/memoize: delete Bind(cleanup) hook
+ 2022-07-01 bec0cf16b internal/lsp/cache: avoid Handle mechanism for workspace dir
+ 2022-07-01 ffc70b9ac lsp/completion: fix ranking of *types.PkgName candidates
+ 2022-07-01 93bf1fcc7 gopls: add range over channel postfix completion
+ 2022-07-01 79fefdf61 internal/memoize: do not iterate all handles on generation destruction
+ 2022-07-01 fa4babcd9 internal/lsp/cache: use persistent map for storing packages in the snapshot

Change-Id: If2b0e078a3d689617090269ad9ba26edeafaa62c
tree: 3e5f0d89047e5a959731dd3c4bd2eba77e98b3cf
  1. benchmark/
  2. blog/
  3. cmd/
  4. container/
  5. copyright/
  6. cover/
  7. go/
  8. godoc/
  9. gopls/
  10. imports/
  11. internal/
  12. playground/
  13. present/
  14. refactor/
  15. txtar/
  16. .gitattributes
  17. .gitignore
  18. .prettierrc
  19. codereview.cfg
  21. go.mod
  22. go.sum

Go Tools


This repository provides the module, comprising various tools and packages mostly for static analysis of Go programs, some of which are listed below. Use the “Go reference” link above for more information about any package.

It also contains the module, whose root package is a language-server protocol (LSP) server for Go. An LSP server analyses the source code of a project and responds to requests from a wide range of editors such as VSCode and Vim, allowing them to support IDE-like functionality.

Selected commands:

  • cmd/goimports formats a Go program like go fmt and additionally inserts import statements for any packages required by the file after it is edited.
  • cmd/callgraph prints the call graph of a Go program.
  • cmd/digraph is a utility for manipulating directed graphs in textual notation.
  • cmd/stringer generates declarations (including a String method) for “enum” types.
  • cmd/toolstash is a utility to simplify working with multiple versions of the Go toolchain.

These commands may be fetched with a command such as go install

Selected packages:

  • go/ssa provides a static single-assignment form (SSA) intermediate representation (IR) for Go programs, similar to a typical compiler, for use by analysis tools.

  • go/packages provides a simple interface for loading, parsing, and type checking a complete Go program from source code.

  • go/analysis provides a framework for modular static analysis of Go programs.

  • go/callgraph provides call graphs of Go programs using a variety of algorithms with different trade-offs.

  • go/ast/inspector provides an optimized means of traversing a Go parse tree for use in analysis tools.

  • go/cfg provides a simple control-flow graph (CFG) for a Go function.

  • go/expect reads Go source files used as test inputs and interprets special comments within them as queries or assertions for testing.

  • go/gcexportdata and go/gccgoexportdata read and write the binary files containing type information used by the standard and gccgo compilers.

  • go/types/objectpath provides a stable naming scheme for named entities (“objects”) in the go/types API.

Numerous other packages provide more esoteric functionality.


This repository uses Gerrit for code changes. To learn how to submit changes, see

The main issue tracker for the tools repository is located at Prefix your issue with “x/tools/(your subdir):” in the subject line, so it is easy to find.

JavaScript and CSS Formatting

This repository uses prettier to format JS and CSS files.

The version of prettier used is 1.18.2.

It is encouraged that all JS and CSS code be run through this before submitting a change. However, it is not a strict requirement enforced by CI.