builder

package
v0.0.0-...-2245ba8 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

package builder can be used in testing to create a temporary gopath, src, namespace and package directory, and populate it with source files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder can be used in testing to create a temporary gopath, src, namespace and package directory, and populate it with source files.

func New

func New(env vos.Env, namespace string) (*Builder, error)

New creates a new gopath in the system temporary location, creates the src dir and the namespace dir. The gopath is appended to the beginning of the existing gopath, so existing imports will still work. Remember to defer the Cleanup() method to delete the temporary files.

func (*Builder) Cleanup

func (b *Builder) Cleanup()

Cleanup deletes all temporary files.

func (*Builder) File

func (b *Builder) File(packageName, filename, contents string) error

File creates a new source file in the package.

func (*Builder) Package

func (b *Builder) Package(packageName string, files map[string]string) (packagePath string, packageDir string, err error)

Package creates a new package and populates with source files.

Jump to

Keyboard shortcuts

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