Help us shape the future of Go! Take the 2026 Go Developer Survey

context

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Chroot            string
	EnableTools       bool
	SnapshotPath      string
	SnapshotRoot      string
	SnapshotExclusive bool
	// contains filtered or unexported fields
}

Concrete merged set of configuration switches that act as an execution context when calling internal discovery methods

func FromEnv

func FromEnv() *Context

FromEnv returns an Option that has been populated from the environs or default options values

func New

func New(opts ...*option.Option) *Context

New returns a Context struct pointer that has had various options set on it

func (*Context) Do

func (ctx *Context) Do(fn func() error) error

Do wraps a Setup/Teardown pair around the given function

func (*Context) Setup

func (ctx *Context) Setup() error

Setup prepares the extra optional data a Context may use. `Context`s are ready to use once returned by `New`. Optional features, like snapshot unpacking, may require extra steps. Run `Setup` to perform them. You should call `Setup` just once. It is safe to call `Setup` if you don't make use of optional extra features - `Setup` will do nothing.

func (*Context) Teardown

func (ctx *Context) Teardown() error

Teardown releases any resource acquired by Setup. You should always call `Teardown` if you called `Setup` to free any resources acquired by `Setup`. Check `Do` for more automated management.

func (*Context) Warn

func (ctx *Context) Warn(msg string, args ...interface{})

Jump to

Keyboard shortcuts

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