MCPcopy
hub / github.com/golang/tools

github.com/golang/tools @gopls-v0.22.0 sqlite

repository ↗ · DeepWiki ↗ · release gopls-v0.22.0 ↗
14,685 symbols 68,256 edges 1,896 files 6,893 documented · 47%
README

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/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://go.dev/doc/contribute.

The git repository is https://go.googlesource.com/tools.

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

Extension points exported contracts — how you extend this code

RunOption (Interface)
A RunOption augments the behavior of the test runner. [6 implementers]
gopls/internal/test/integration/options.go
Elem (Interface)
Elem defines the interface for a present element. That is, something that can provide the name of the template used to r [10 …
present/parse.go
Fact (Interface)
A Fact is an intermediate fact produced during analysis. Each fact is associated with a named declaration (a types.Obje [13 …
go/analysis/analysis.go
Value (Interface)
A Value is an SSA value that can be referenced by an instruction. [7 implementers]
go/ssa/ssa.go
Reader (Interface)
Reader abstracts the transport mechanics from the JSON RPC protocol. A Conn reads messages from the reader it was provid [10 …
internal/jsonrpc2_v2/frame.go
Application (Interface)
Application is the interface that must be satisfied by an object passed to Main. [33 implementers]
internal/tool/tool.go
Key (Interface)
Key is used as the identity of a Label. Keys are intended to be compared by pointer only, the name should be unique for [8 …
internal/event/label/label.go
Stream (Interface)
Stream abstracts the transport mechanics from the JSON RPC protocol. A Conn reads and writes messages using the stream i [5 …
internal/jsonrpc2/stream.go

Core symbols most depended-on inside this repo

Errorf
called by 3271
go/analysis/analysistest/analysistest.go
append
called by 2671
go/analysis/passes/appends/testdata/src/b/b.go
Pos
called by 989
go/ssa/ssa.go
Type
called by 852
go/ssa/ssa.go
Name
called by 825
go/ssa/ssa.go
WriteString
called by 675
go/ssa/testdata/src/strings/strings.go
Run
called by 608
internal/tool/tool.go
Fatalf
called by 540
go/analysis/passes/testinggoroutine/testdata/src/a/a.go

Shape

Function 6,965
Method 4,844
Struct 2,112
TypeAlias 492
Interface 195
FuncType 77

Languages

Go99%
TypeScript1%

Modules by API surface

gopls/internal/protocol/tsprotocol.go502 symbols
go/ssa/ssa.go226 symbols
gopls/internal/protocol/tsserver.go155 symbols
gopls/internal/protocol/tsjson.go136 symbols
go/packages/packages_test.go135 symbols
cmd/splitdwarf/internal/macho/file.go109 symbols
go/analysis/passes/printf/testdata/src/a/a.go106 symbols
gopls/internal/protocol/command/interface.go103 symbols
gopls/internal/test/marker/marker_test.go101 symbols
gopls/internal/golang/completion/completion.go98 symbols
gopls/internal/test/integration/fake/editor.go91 symbols
go/ssa/interp/testdata/rangefunc.go89 symbols

Dependencies from manifests, versioned

github.com/fatih/camelcasev1.0.0 · 1×
github.com/fatih/gomodifytagsv1.17.1-0.2025042314 · 1×
github.com/fatih/structtagv1.2.0 · 1×
github.com/fsnotify/fsnotifyv1.9.0 · 1×
github.com/google/jsonschema-gov0.4.2 · 1×
github.com/google/safehtmlv0.1.0 · 1×
github.com/jba/templatecheckv0.7.1 · 1×
github.com/modelcontextprotocol/go-sdkv1.4.0 · 1×
github.com/segmentio/asmv1.2.1 · 1×
github.com/segmentio/encodingv0.5.3 · 1×

Datastores touched

(mongodb)Database · 1 repos

For agents

$ claude mcp add tools \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact