toolsgolang.org/x/tools/internal/drivertest Index | Files

package drivertest

import "golang.org/x/tools/internal/drivertest"

The drivertest package provides a fake implementation of the go/packages driver protocol that delegates to the go list driver. It may be used to test programs such as gopls that specialize behavior when a go/packages driver is in use.

The driver is run as a child of the current process, by calling RunIfChild at process start, and running go/packages with the environment variables set by Env.

Index

Functions

func Env

func Env(t interface{ Fatal(...any) }) []string

Env returns additional environment variables for use in packages.Config to enable the use of drivertest as the driver.

t abstracts a *testing.T or log.Default().

func RunIfChild

func RunIfChild()

RunIfChild runs the current process as a go/packages driver, if configured to do so by the current environment (see Env).

Otherwise, RunIfChild is a no op.

Source Files

driver.go

Version
v0.30.0 (latest)
Published
Feb 10, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
8 hours ago

Tools for package owners.