all: merge master (304195c) into gopls-release-branch.0.8

Also add a replace directive for x/tools to gopls/go.mod.

For golang/go#52892

Conflicts:

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

Merge List:

+ 2022-05-13 304195cc go/ssa: create *ssa.selection.
+ 2022-05-12 f918e87c gopls/internal/vulncheck: copy logic of govulncheck -html
+ 2022-05-12 a518b798 gopls/internal/vulncheck: synchronize cache access
+ 2022-05-12 ad497c6c internal/lsp/cmd: add -config option to gopls vulncheck
+ 2022-05-12 62d837c1 go/analysis/passes/httpresponse: minor clarification
+ 2022-05-11 6eb3de26 internal/lsp/analysis: fix a doc comment typo
+ 2022-05-11 728485ff gopls/internal/regtest: add a test for using staticcheck with generics
+ 2022-05-11 1a5eed31 cmd/compilebench: use -p, handle packages with asm files
+ 2022-05-11 93852cb6 internal/lsp: fix source.CompareDiagnostic asymmetry
+ 2022-05-11 8ec40b53 x/tools/go/ssa: instantiate sel.Recv() on MethodVal.
+ 2022-05-11 28c754d4 internal/lsp/analysis: analyzer for //go:embed directive
+ 2022-05-11 033cbfc7 internal/typeparams: run go generate with go1.18.2
+ 2022-05-10 bc0e26ea internal/typeparams: remove examples in favor of x/exp/typeparams
+ 2022-05-09 b87ceec0 go/analysis/passes/httpresponse: inspect enclosing context of resp, err
+ 2022-05-09 313af968 go/ast/astutil: make Apply follow TypeParams fields
+ 2022-05-09 d3036686 internal/lsp/cache: use cached parsed files for symbols, if available
+ 2022-05-09 0fb1abf2 internal/lsp: factor out go/token wrapper into a safetoken package
+ 2022-05-09 cde25b3a internal/lsp/lsppos: add helpers for mapping token positions
+ 2022-05-06 22b70963 internal/lsp/cmd: change vulncheck to directly call the hook
+ 2022-05-06 72a884b2 gopls: update golang.org/x/vuln dependency
+ 2022-05-06 d7e01c03 internal/lsp/source/completion: use typeutil.Map for short-circuiting
+ 2022-05-05 d299b946 passes/copylock: suppress reports on Offsetof and Alignof
+ 2022-05-05 30fbd19e internal/lsp: fix fillstruct for structs with unsafe.Pointer
+ 2022-05-05 0ebacc11 internal: remove pre-go1.12 conditionally compiled files
+ 2022-05-04 45c8a713 internal/tool: implement structured help command
+ 2022-05-04 d27d783e cmd/godoc: expand skips in TestWeb
+ 2022-05-04 4911e4af internal/testenv: remove darwin/arm case from NeedsGoBuild
+ 2022-05-04 54c7ba52 go/analysis/passes/asmdecl: add build tag for loong64
+ 2022-05-04 b4c45006 README: restructure and update
+ 2022-05-02 556c550a internal/lsp/cache: invalidate packages that have added files
+ 2022-05-02 4a3fc218 internal/lsp: only linkify urls with http, https, and ftp schemes
+ 2022-05-02 04fc2ba8 cmd/godoc: skip TestWeb if waitForServerReady fails
+ 2022-05-02 6872d3b8 passes/unusedwrites: Add TODO for how to handle generics.
+ 2022-05-02 7c895e06 pointer: Adds unit tests for pointer with type parameters.
+ 2022-05-02 ddadc42f guru: Add a TODO list to the guru cmd.
+ 2022-05-02 c39ac6a1 callgraph/vta: Removes dead return statement (misc cleanup).
+ 2022-04-29 aaffface internal/lsp/source: avoid panic in HoverIdentifier
+ 2022-04-29 c862641e cmd/digraph: only print non-trivial sccs
+ 2022-04-29 6fff1af1 go/analysis/passes/errorsas: update testdata for new warning
+ 2022-04-28 115b454b go/analysis/passes/errorsas: warn if errors.As target is *error
+ 2022-04-28 60b44566 go/callgraph/static: adds tests for (instantiated) generics
+ 2022-04-28 a37ba141 go/callgraph/cha: adds tests for (instantiated) generics
+ 2022-04-26 dcaea06a go/callgraph/vta: adds tests for (instantiated) generics
+ 2022-04-26 b44fad84 lsp/completion: fix func literals with type params
+ 2022-04-26 5bb9a5ec lsp/completion: fix literal completions with type params
+ 2022-04-26 09412940 lsp/completion: further improve generic func arg ranking
+ 2022-04-25 c9035635 internal/lsp/cache: don't cache parsed files when checking for metadata changes
+ 2022-04-25 825b6610 nilness: add unit test for generic instantiation.
+ 2022-04-25 2548a8b1 ssautil: Add unit tests that set ssa.InstantiateGenerics
+ 2022-04-25 ae12e8f2 ssa: switch lblocks to types.Object
+ 2022-04-25 559469ae internal/lsp: render package documentation when hovering over a package import
+ 2022-04-22 fa7afc95 lsp/completion: improve generic func arg ranking
+ 2022-04-22 d567bc1c go/ssa: monomorphize generic instantiations.
+ 2022-04-20 5d7ca8a1 go/ssa: return nil on parameterized types on MethodValue.
+ 2022-04-20 48a2cc8a x/tools: remove dependency on golang.org/x/xerrors
+ 2022-04-20 235b13d9 cmd/godoc: remove usage of golang.org/x/xerrors
+ 2022-04-20 b22f048f internal/jsonrpc2*: remove usage of golang.org/x/xerrors
+ 2022-04-20 bcfc38ff go/packages: remove usage of golang.org/x/xerrors
+ 2022-04-20 37590b38 gopls: remove usage of golang.org/x/xerrors
+ 2022-04-19 e854e022 go/ssa: fix miscompilation of <<= and >>= statements
+ 2022-04-19 c02adccb go/packages: ask for EmbedPatterns and EmbedFiles if needed
+ 2022-04-19 5bb9c48e x/tools/go/packages: on Go 1.19+, explicitly ask for -json fields needed
+ 2022-04-18 00aa68c0 go/ssa/interp: use *ssa.Global as key type for interpreter.globals
+ 2022-04-18 b4aba4bb go/internal/gcimporter: key tparams by Package instead of pkgname
+ 2022-04-15 46bc274e go/ssa: Update callee for wrapper function instantiation.
+ 2022-04-14 884ffcdf go/analysis: add support for loong64
+ 2022-04-13 afc6aad7 go/packages: make loadFromExportData ignore go.shape
+ 2022-04-13 b7d75740 internal/lsp/protocol: avoid replying with non-nil interface values in case of error
+ 2022-04-12 1f107677 gopls/doc: update neovim examples for nvim 0.7
+ 2022-04-12 a2200875 internal/lsp/protocol: ignore reply values with non-nil errors in jsonrpc2_v2 adapters
+ 2022-04-12 d5f48fca all: gofmt
+ 2022-04-12 d996daab go/ssa: gofmt
+ 2022-04-12 f9c13bbb go/pointer: gofmt
+ 2022-04-12 ad8ef159 go/callgraph: gofmt
+ 2022-04-12 ce1e683f go/analysis: gofmt
+ 2022-04-12 2bbdb7a5 gopls, internal/lsp: gofmt
+ 2022-04-12 5fef6fda cmd: gofmt
+ 2022-04-12 04fab9a0 go/callgraph/vta: avoids cycles for pathological recursive types
+ 2022-04-12 fbebf43d go/internal: gofmt
+ 2022-04-12 b900e880 go/ssa: emit Low expression before High in *ast.Slice
+ 2022-04-11 b2552ef5 internal/lsp: run go mod vendor exclusively to avoid file contention
+ 2022-04-11 9e788ee1 internal/lsp/fake: consider mtime when polling for file changes
+ 2022-04-08 fe932b46 go/ssa: Instantiate calls to generic functions and methods.
+ 2022-04-08 ce5936cd go/ssa: bound functions are now unique per instantiation.
+ 2022-04-08 7dd9f20e go/ssa: Adds datastructures for function instantiation.
+ 2022-04-07 ee2bc8be go/ast/astutil: fix panic in DeleteNamedImport from line directive
+ 2022-04-07 48e6d8d2 cmd/fiximports: skip TestFixImports on plan9-arm

Change-Id: Ife04cdbc94bfd70ff81c94cdfb9516950256847d
tree: 6079bdda7bab476a22e65105d9ace663ee4b9cac
  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. AUTHORS
  20. codereview.cfg
  21. CONTRIBUTING.md
  22. CONTRIBUTORS
  23. go.mod
  24. go.sum
  25. LICENSE
  26. PATENTS
  27. README.md
README.md

Go Tools

PkgGoDev

This repository provides the golang.org/x/tools 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 golang.org/x/tools/gopls 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 golang.org/x/tools/cmd/goimports@latest.

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.

Contributing

This repository uses Gerrit for code changes. To learn how to submit changes, see https://golang.org/doc/contribute.html.

The main issue tracker for the tools repository is located at https://github.com/golang/go/issues. 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.