Documentation ¶
Overview ¶
Gopls (pronounced “go please”) is an LSP server for Go. The Language Server Protocol allows any text editor to be extended with IDE-like features; see https://langserver.org/ for details.
See https://github.com/golang/tools/blob/master/gopls/README.md for the most up-to-date documentation.
Directories ¶
Path | Synopsis |
---|---|
doc
|
|
generate
The generate command updates the following files of documentation:
|
The generate command updates the following files of documentation: |
assets
Module
|
|
integration
|
|
internal
|
|
analysis/deprecated
Package deprecated defines an Analyzer that marks deprecated symbols and package imports.
|
Package deprecated defines an Analyzer that marks deprecated symbols and package imports. |
analysis/embeddirective
Package embeddirective defines an Analyzer that validates //go:embed directives.
|
Package embeddirective defines an Analyzer that validates //go:embed directives. |
analysis/fillreturns
Package fillreturns defines an Analyzer that will attempt to automatically fill in a return statement that has missing values with zero value elements.
|
Package fillreturns defines an Analyzer that will attempt to automatically fill in a return statement that has missing values with zero value elements. |
analysis/fillstruct
Package fillstruct defines an Analyzer that automatically fills in a struct declaration with zero value elements for each field.
|
Package fillstruct defines an Analyzer that automatically fills in a struct declaration with zero value elements for each field. |
analysis/fillswitch
Package fillswitch identifies switches with missing cases.
|
Package fillswitch identifies switches with missing cases. |
analysis/nonewvars
Package nonewvars defines an Analyzer that applies suggested fixes to errors of the type "no new variables on left side of :=".
|
Package nonewvars defines an Analyzer that applies suggested fixes to errors of the type "no new variables on left side of :=". |
analysis/noresultvalues
Package noresultvalues defines an Analyzer that applies suggested fixes to errors of the type "no result values expected".
|
Package noresultvalues defines an Analyzer that applies suggested fixes to errors of the type "no result values expected". |
analysis/simplifycompositelit
Package simplifycompositelit defines an Analyzer that simplifies composite literals.
|
Package simplifycompositelit defines an Analyzer that simplifies composite literals. |
analysis/simplifyrange
Package simplifyrange defines an Analyzer that simplifies range statements.
|
Package simplifyrange defines an Analyzer that simplifies range statements. |
analysis/simplifyslice
Package simplifyslice defines an Analyzer that simplifies slice statements.
|
Package simplifyslice defines an Analyzer that simplifies slice statements. |
analysis/stubmethods
Package stubmethods defines a code action for missing interface methods.
|
Package stubmethods defines a code action for missing interface methods. |
analysis/undeclaredname
Package undeclaredname defines an Analyzer that applies suggested fixes to errors of the type "undeclared name: %s".
|
Package undeclaredname defines an Analyzer that applies suggested fixes to errors of the type "undeclared name: %s". |
analysis/unusedparams
Package unusedparams defines an analyzer that checks for unused parameters of functions.
|
Package unusedparams defines an analyzer that checks for unused parameters of functions. |
analysis/unusedparams/cmd
The unusedparams command runs the unusedparams analyzer.
|
The unusedparams command runs the unusedparams analyzer. |
analysis/unusedvariable
Package unusedvariable defines an analyzer that checks for unused variables.
|
Package unusedvariable defines an analyzer that checks for unused variables. |
analysis/useany
Package useany defines an Analyzer that checks for usage of interface{} in constraints, rather than the predeclared any.
|
Package useany defines an Analyzer that checks for usage of interface{} in constraints, rather than the predeclared any. |
analysisinternal
Package analysisinternal provides gopls' internal analyses with a number of helper functions that operate on typed syntax trees.
|
Package analysisinternal provides gopls' internal analyses with a number of helper functions that operate on typed syntax trees. |
cache
Package cache is the core of gopls: it is concerned with state management, dependency analysis, and invalidation; and it holds the machinery of type checking and modular static analysis.
|
Package cache is the core of gopls: it is concerned with state management, dependency analysis, and invalidation; and it holds the machinery of type checking and modular static analysis. |
cache/metadata
The metadata package defines types and functions for working with package metadata, which describes Go packages and their relationships.
|
The metadata package defines types and functions for working with package metadata, which describes Go packages and their relationships. |
cache/methodsets
Package methodsets defines an incremental, serializable index of method-set information that allows efficient 'implements' queries across packages of the workspace without using the type checker.
|
Package methodsets defines an incremental, serializable index of method-set information that allows efficient 'implements' queries across packages of the workspace without using the type checker. |
cache/typerefs
Package typerefs extracts symbol-level reachability information from the syntax of a Go package.
|
Package typerefs extracts symbol-level reachability information from the syntax of a Go package. |
cache/xrefs
Package xrefs defines the serializable index of cross-package references that is computed during type checking.
|
Package xrefs defines the serializable index of cross-package references that is computed during type checking. |
clonetest
Package clonetest provides utility functions for testing Clone operations.
|
Package clonetest provides utility functions for testing Clone operations. |
cmd
Package cmd handles the gnopls command line.
|
Package cmd handles the gnopls command line. |
debug
Package debug exports debug information for gopls.
|
Package debug exports debug information for gopls. |
debug/log
Package log provides helper methods for exporting log events to the internal/event package.
|
Package log provides helper methods for exporting log events to the internal/event package. |
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/gnoverse/gnopls/internal/diff"
|
Package difftest supplies a set of tests that will operate on any implementation of a diff algorithm as exposed by "github.com/gnoverse/gnopls/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. |
doc
The doc package provides JSON metadata that documents gopls' public interfaces.
|
The doc package provides JSON metadata that documents gopls' public interfaces. |
drivertest
The drivertest package provides a fake implementation of the go/packages driver protocol that delegates to the go list driver.
|
The drivertest package provides a fake implementation of the go/packages driver protocol that delegates to the go list driver. |
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/export/eventtest
Package eventtest supports logging events to a test.
|
Package eventtest supports logging events to a test. |
event/export/metric
Package metric aggregates events into metrics that can be exported.
|
Package metric aggregates events into metrics that can be exported. |
event/export/ocagent
Package ocagent adds the ability to export all telemetry to an ocagent.
|
Package ocagent adds the ability to export all telemetry to an ocagent. |
facts
Package facts defines a serializable set of analysis.Fact.
|
Package facts defines a serializable set of analysis.Fact. |
file
The file package defines types used for working with LSP files.
|
The file package defines types used for working with LSP files. |
filecache
The filecache package provides a file-based shared durable blob cache.
|
The filecache package provides a file-based shared durable blob cache. |
fuzzy
Package fuzzy implements a fuzzy matching algorithm.
|
Package fuzzy implements a fuzzy matching algorithm. |
gcimporter
Package gcimporter provides various functions for reading gc-generated object files that can be used to implement the Importer interface defined by the Go 1.5 standard library package.
|
Package gcimporter provides various functions for reading gc-generated object files that can be used to implement the Importer interface defined by the Go 1.5 standard library package. |
gocommand
Package gocommand is a helper for calling the go command.
|
Package gocommand is a helper for calling the go command. |
golang
Package golang defines the LSP features for navigation, analysis, and refactoring of Go source code.
|
Package golang defines the LSP features for navigation, analysis, and refactoring of Go source code. |
golang/completion
Package completion provides core functionality for code completion in Go editors and tools.
|
Package completion provides core functionality for code completion in Go editors and tools. |
golang/completion/snippet
Package snippet implements the specification for the LSP snippet format.
|
Package snippet implements the specification for the LSP snippet format. |
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. |
label
Package label provides common labels used to annotate gopls log messages and events.
|
Package label provides common labels used to annotate gopls log messages and events. |
lsprpc
Package lsprpc implements a jsonrpc2.StreamServer that may be used to serve the LSP on a jsonrpc2 channel.
|
Package lsprpc implements a jsonrpc2.StreamServer that may be used to serve the LSP on a jsonrpc2 channel. |
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. |
mod
Package mod provides core features related to go.mod file handling for use by Go editors and tools.
|
Package mod provides core features related to go.mod file handling for use by Go editors and tools. |
packages
Package packages loads Go packages for inspection and analysis.
|
Package packages loads Go packages for inspection and analysis. |
packages/gopackages
The gopackages command is a diagnostic tool that demonstrates how to use github.com/gnoverse/gnopls/internal/packages to load, parse, type-check, and print one or more Go packages.
|
The gopackages command is a diagnostic tool that demonstrates how to use github.com/gnoverse/gnopls/internal/packages to load, parse, type-check, and print one or more Go packages. |
packages/internal/nodecount
The nodecount program illustrates the use of packages.Load to print the frequency of occurrence of each type of syntax node among the selected packages.
|
The nodecount program illustrates the use of packages.Load to print the frequency of occurrence of each type of syntax node among the selected packages. |
packages/packagestest
Package packagestest creates temporary projects on disk for testing go tools on.
|
Package packagestest creates temporary projects on disk for testing go tools on. |
packagesinternal
Package packagesinternal exposes internal-only fields from go/packages.
|
Package packagesinternal exposes internal-only fields from go/packages. |
pkgbits
Package pkgbits implements low-level coding abstractions for Unified IR's export data format.
|
Package pkgbits implements low-level coding abstractions for Unified IR's export data format. |
pprof
Package pprof provides minimalistic routines for extracting information from profiles.
|
Package pprof provides minimalistic routines for extracting information from profiles. |
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. |
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. |
protocol/command
Package command defines the interface provided by gopls for the workspace/executeCommand LSP request.
|
Package command defines the interface provided by gopls for the workspace/executeCommand LSP request. |
protocol/command/commandmeta
Package commandmeta provides metadata about LSP commands, by statically analyzing the command.Interface type.
|
Package commandmeta provides metadata about LSP commands, by statically analyzing the command.Interface type. |
protocol/command/gen
Package gen is used to generate command bindings from the gopls command interface.
|
Package gen is used to generate command bindings from the gopls command interface. |
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. |
protocol/semtok
The semtok package provides an encoder for LSP's semantic tokens.
|
The semtok package provides an encoder for LSP's semantic tokens. |
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>". |
refactor/inline
Package inline implements inlining of Go function calls.
|
Package inline implements inlining of Go function calls. |
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. |
server
Package server defines gopls' implementation of the LSP server interface, protocol.Server.
|
Package server defines gopls' implementation of the LSP server interface, protocol.Server. |
stack
Package stack provides support for parsing standard goroutine stack traces.
|
Package stack provides support for parsing standard goroutine stack traces. |
stack/gostacks
The gostacks command processes stdin looking for things that look like stack traces and simplifying them to make the log more readable.
|
The gostacks command processes stdin looking for things that look like stack traces and simplifying them to make the log more readable. |
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. |
telemetry/cmd/stacks
The stacks command finds all gopls stack traces reported by telemetry in the past 7 days, and reports their associated GitHub issue, creating new issues as needed.
|
The stacks command finds all gopls stack traces reported by telemetry in the past 7 days, and reports their associated GitHub issue, creating new issues as needed. |
template
Package template contains code for dealing with templates
|
Package template contains code for dealing with templates |
test/integration
Package integration provides a framework for writing integration tests of gopls.
|
Package integration provides a framework for writing integration tests of gopls. |
test/integration/bench
The bench package implements benchmarks for various LSP operations.
|
The bench package implements benchmarks for various LSP operations. |
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. |
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. |
test/marker
Package marker defines a framework for running "marker" tests, each defined by a file in the testdata subdirectory.
|
Package marker defines a framework for running "marker" tests, each defined by a file in the testdata subdirectory. |
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. |
testfiles
Package testfiles provides utilities for writing Go tests with files in testdata.
|
Package testfiles provides utilities for writing Go tests with files in testdata. |
tokeninternal
package tokeninternal provides access to some internal features of the token package.
|
package tokeninternal provides access to some internal features of the token package. |
tool
Package tool is a harness for writing Go tools.
|
Package tool is a harness for writing Go tools. |
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. |
typeparams/genericfeatures
The genericfeatures package provides utilities for detecting usage of generic programming in Go packages.
|
The genericfeatures package provides utilities for detecting usage of generic programming in Go packages. |
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. |
util/astutil
Package astutil provides various AST utility functions for gopls.
|
Package astutil provides various AST utility functions for gopls. |
util/browser
Package browser provides utilities for interacting with users' browsers.
|
Package browser provides utilities for interacting with users' browsers. |
util/bug
Package bug provides utilities for reporting internal bugs, and being notified when they occur.
|
Package bug provides utilities for reporting internal bugs, and being notified when they occur. |
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. |
util/frob
Package frob is a fast restricted object encoder/decoder in the spirit of encoding/gob.
|
Package frob is a fast restricted object encoder/decoder in the spirit of encoding/gob. |
util/goversion
Package goversions defines gopls's policy for which versions of Go it supports.
|
Package goversions defines gopls's policy for which versions of Go it supports. |
util/immutable
The immutable package defines immutable wrappers around common data structures.
|
The immutable package defines immutable wrappers around common data structures. |
util/lru
The lru package implements a fixed-size in-memory LRU cache.
|
The lru package implements a fixed-size in-memory LRU cache. |
util/persistent
The persistent package defines various persistent data structures; that is, data structures that can be efficiently copied and modified in sublinear time.
|
The persistent package defines various persistent data structures; that is, data structures that can be efficiently copied and modified in sublinear time. |
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. |
version
Package version manages the gopls version.
|
Package version manages the gopls version. |
vulncheck/govulncheck
Package govulncheck contains the JSON output structs for govulncheck.
|
Package govulncheck contains the JSON output structs for govulncheck. |
vulncheck/osv
Package osv implements the Go OSV vulnerability format (https://go.dev/security/vuln/database#schema), which is a subset of the OSV shared vulnerability format (https://ossf.github.io/osv-schema), with database and ecosystem-specific meanings and fields.
|
Package osv implements the Go OSV vulnerability format (https://go.dev/security/vuln/database#schema), which is a subset of the OSV shared vulnerability format (https://ossf.github.io/osv-schema), with database and ecosystem-specific meanings and fields. |
vulncheck/semver
Package semver provides shared utilities for manipulating Go semantic versions.
|
Package semver provides shared utilities for manipulating Go semantic versions. |
vulncheck/vulntest
Package vulntest provides helpers for vulncheck functionality testing.
|
Package vulntest provides helpers for vulncheck functionality testing. |
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. |
pkg
|
|
Click to show internal directories.
Click to hide internal directories.