driver

package
v0.0.0-...-b1d4c68 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnv

func GetEnv(cfg *Request, name, def string) string

GetEnv returns a value from cfg.Env, or def if the value isn't found.

func Run

func Run(driver Driver)

Run implements the gopackagesdriver protocol. It reads a DriverRequest from stdin, passes the request to driver, and writes the response to stdout. If driver returns an error, Run will terminate the process.

Types

type Driver

type Driver func(cfg Request, patterns ...string) (*Response, error)

Driver is the gopackagesdriver implementation

type Request

type Request struct {
	Command    string            `json:"command"` // FIXME ???
	Mode       packages.LoadMode `json:"mode"`
	Env        []string          `json:"env"` // FIXME handle
	BuildFlags []string          `json:"build_flags"`
	Tests      bool              `json:"tests"`   // FIXME handle
	Overlay    map[string][]byte `json:"overlay"` // FIXME handle
}

Request is a JSON object sent by golang.org/x/tools/go/packages on stdin. Keep in sync.

type Response

type Response struct {
	NotHandled bool

	// Sizes, if not nil, is the types.Sizes to use when type checking.
	Sizes *types.StdSizes

	// Roots is the set of package IDs that make up the root packages.
	// We have to encode this separately because when we encode a single package
	// we cannot know if it is one of the roots as that requires knowledge of the
	// graph it is part of.
	Roots []string `json:",omitempty"`

	// Packages is the full set of packages in the graph.
	// The packages are not connected into a graph.
	// The Imports if populated will be stubs that only have their ID set.
	// Imports will be connected and then type and syntax information added in a
	// later pass (see refine).
	Packages []*packages.Package
}

Response is a JSON object sent by this program to golang.org/x/tools/go/packages on stdout. Keep in sync.

Jump to

Keyboard shortcuts

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