tools-lite

module
v0.0.0-...-60bfa88 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2024 License: BSD-3-Clause

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/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.

Directories

Path Synopsis
cmd
internal2pkg Module
go
ast/astutil
Package astutil contains common utilities for working with the Go AST.
Package astutil contains common utilities for working with the Go AST.
expect
Package expect provides support for interpreting structured comments in Go source code as test expectations.
Package expect provides support for interpreting structured comments in Go source code as test expectations.
gopls
pkg/file
The file package defines types used for working with LSP files.
The file package defines types used for working with LSP files.
pkg/progress
The progress package defines utilities for reporting the progress of long-running operations using features of the LSP client interface such as Progress and ShowMessage.
The progress package defines utilities for reporting the progress of long-running operations using features of the LSP client interface such as Progress and ShowMessage.
pkg/protocol
Package protocol contains the structs that map directly to the request and response messages of the Language Server Protocol.
Package protocol contains the structs that map directly to the request and response messages of the Language Server Protocol.
pkg/protocol/generate
The generate command generates Go declarations from VSCode's description of the Language Server Protocol.
The generate command generates Go declarations from VSCode's description of the Language Server Protocol.
pkg/test/integration
Package integration provides a framework for writing integration tests of gopls.
Package integration provides a framework for writing integration tests of gopls.
pkg/test/integration/fake
Package fake provides a fake implementation of an LSP-enabled text editor, its LSP client plugin, and a Sandbox environment for use in integration tests.
Package fake provides a fake implementation of an LSP-enabled text editor, its LSP client plugin, and a Sandbox environment for use in integration tests.
pkg/test/integration/fake/glob
Package glob implements an LSP-compliant glob pattern matcher for testing.
Package glob implements an LSP-compliant glob pattern matcher for testing.
pkg/util/astutil
Package astutil provides various AST utility functions for gopls.
Package astutil provides various AST utility functions for gopls.
pkg/util/constraints
Package constraints defines a set of useful constraints to be used with type parameters.
Package constraints defines a set of useful constraints to be used with type parameters.
pkg/util/safetoken
Package safetoken provides wrappers around methods in go/token, that return errors rather than panicking.
Package safetoken provides wrappers around methods in go/token, that return errors rather than panicking.
pkg
diff
Package diff computes differences between text files or strings.
Package diff computes differences between text files or strings.
diff/difftest
Package difftest supplies a set of tests that will operate on any implementation of a diff algorithm as exposed by "github.com/kralicky/tools-lite/internal/diff"
Package difftest supplies a set of tests that will operate on any implementation of a diff algorithm as exposed by "github.com/kralicky/tools-lite/internal/diff"
diff/lcs
package lcs contains code to find longest-common-subsequences (and diffs)
package lcs contains code to find longest-common-subsequences (and diffs)
diff/myers
Package myers implements the Myers diff algorithm.
Package myers implements the Myers diff algorithm.
event
Package event provides a set of packages that cover the main concepts of telemetry in an implementation agnostic way.
Package event provides a set of packages that cover the main concepts of telemetry in an implementation agnostic way.
event/core
Package core provides support for event based telemetry.
Package core provides support for event based telemetry.
event/tag
Package tag provides the labels used for telemetry throughout gopls.
Package tag provides the labels used for telemetry throughout gopls.
fuzzy
Package fuzzy implements a fuzzy matching algorithm.
Package fuzzy implements a fuzzy matching algorithm.
gocommand
Package gocommand is a helper for calling the go command.
Package gocommand is a helper for calling the go command.
gopathwalk
Package gopathwalk is like filepath.Walk but specialized for finding Go packages, particularly in $GOPATH and $GOROOT.
Package gopathwalk is like filepath.Walk but specialized for finding Go packages, particularly in $GOPATH and $GOROOT.
goroot
Package goroot is a copy of package internal/goroot in the main GO repot.
Package goroot is a copy of package internal/goroot in the main GO repot.
imports
Package imports implements a Go pretty-printer (like package "go/format") that also adds or removes import statements as necessary.
Package imports implements a Go pretty-printer (like package "go/format") that also adds or removes import statements as necessary.
jsonrpc2
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
jsonrpc2/servertest
Package servertest provides utilities for running tests against a remote LSP server.
Package servertest provides utilities for running tests against a remote LSP server.
jsonrpc2_v2
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
memoize
Package memoize defines a "promise" abstraction that enables memoization of the result of calling an expensive but idempotent function.
Package memoize defines a "promise" abstraction that enables memoization of the result of calling an expensive but idempotent function.
proxydir
Package proxydir provides functions for writing module data to a directory in proxy format, so that it can be used as a module proxy by setting GOPROXY="file://<dir>".
Package proxydir provides functions for writing module data to a directory in proxy format, so that it can be used as a module proxy by setting GOPROXY="file://<dir>".
robustio
Package robustio wraps I/O functions that are prone to failure on Windows, transparently retrying errors up to an arbitrary timeout.
Package robustio wraps I/O functions that are prone to failure on Windows, transparently retrying errors up to an arbitrary timeout.
stdlib
Package stdlib provides a table of all exported symbols in the standard library, along with the version at which they first appeared.
Package stdlib provides a table of all exported symbols in the standard library, along with the version at which they first appeared.
testenv
Package testenv contains helper functions for skipping tests based on which tools are present in the environment.
Package testenv contains helper functions for skipping tests based on which tools are present in the environment.
typeparams
Package typeparams contains common utilities for writing tools that interact with generic Go code, as introduced with Go 1.18.
Package typeparams contains common utilities for writing tools that interact with generic Go code, as introduced with Go 1.18.
typesinternal
Package typesinternal provides access to internal go/types APIs that are not yet exported.
Package typesinternal provides access to internal go/types APIs that are not yet exported.
xcontext
Package xcontext is a package to offer the extra functionality we need from contexts that is not available from the standard context package.
Package xcontext is a package to offer the extra functionality we need from contexts that is not available from the standard context package.
Package txtar implements a trivial text-based file archive format.
Package txtar implements a trivial text-based file archive format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL