tools: Index | Files | Directories

package debug

import ""

Package debug exports debug information for gopls.


Package Files

info.1.12.go info.go metrics.go rpc.go serve.go trace.go


const (
    PlainText = PrintMode(iota)


var Version = "master"

Version is a manually-updated mechanism for tracking versions.

func PrintVersionInfo Uses

func PrintVersionInfo(ctx context.Context, w io.Writer, verbose bool, mode PrintMode)

PrintVersionInfo writes version information to w, using the output format specified by mode. verbose controls whether additional information is written, including section headers.

func WithInstance Uses

func WithInstance(ctx context.Context, workdir, agent string) context.Context

WithInstance creates debug instance ready for use using the supplied configuration and stores it in the returned context.

type Client Uses

type Client struct {
    Session      *cache.Session
    DebugAddress string
    Logfile      string
    GoplsPath    string
    ServerID     string

A Client is an incoming connection from a remote client.

type Instance Uses

type Instance struct {
    Logfile              string
    StartTime            time.Time
    ServerAddress        string
    DebugAddress         string
    ListenedDebugAddress string
    Workdir              string
    OCAgentConfig        string

    LogWriter io.Writer

    State *State
    // contains filtered or unexported fields

An Instance holds all debug information associated with a gopls instance.

func GetInstance Uses

func GetInstance(ctx context.Context) *Instance

func (*Instance) MonitorMemory Uses

func (i *Instance) MonitorMemory(ctx context.Context)

MonitorMemory starts recording memory statistics each second.

func (*Instance) PrintServerInfo Uses

func (i *Instance) PrintServerInfo(ctx context.Context, w io.Writer)

PrintServerInfo writes HTML debug info to w for the Instance.

func (*Instance) Serve Uses

func (i *Instance) Serve(ctx context.Context) error

Serve starts and runs a debug server in the background. It also logs the port the server starts on, to allow for :0 auto assigned ports.

func (*Instance) SetLogFile Uses

func (i *Instance) SetLogFile(logfile string, isDaemon bool) (func(), error)

SetLogFile sets the logfile for use with this instance.

type PrintMode Uses

type PrintMode int

type Server Uses

type Server struct {
    ID           string
    DebugAddress string
    Logfile      string
    GoplsPath    string
    ClientID     string

A Server is an outgoing connection to a remote LSP server.

type State Uses

type State struct {
    // contains filtered or unexported fields

State holds debugging information related to the server state.

func (*State) Cache Uses

func (st *State) Cache(id string) *cache.Cache

Cache returns the Cache that matches the supplied id.

func (*State) Caches Uses

func (st *State) Caches() []*cache.Cache

Caches returns the set of Cache objects currently being served.

func (*State) Client Uses

func (st *State) Client(id string) *Client

Client returns the Client matching the supplied id.

func (*State) Clients Uses

func (st *State) Clients() []*Client

Clients returns the set of Clients currently being served.

func (*State) Servers Uses

func (st *State) Servers() []*Server

Servers returns the set of Servers the instance is currently connected to.

func (*State) Session Uses

func (st *State) Session(id string) *cache.Session

Session returns the Session that matches the supplied id.

func (*State) Sessions Uses

func (st *State) Sessions() []*cache.Session

Sessions returns the set of Session objects currently being served.

func (*State) View Uses

func (st *State) View(id string) *cache.View

View returns the View that matches the supplied id.

func (*State) Views Uses

func (st *State) Views() []*cache.View

Views returns the set of View objects currently being served.


tagPackage tag provides the labels used for telemetry throughout gopls.

Package debug imports 34 packages (graph) and is imported by 13 packages. Updated 2020-10-01. Refresh now. Tools for package owners.