Documentation ¶
Overview ¶
Package fakegopath provides utilities to create temporary go source trees.
Index ¶
- type SourceFile
- type Temporary
- func (t *Temporary) Copy(files []SourceFile) error
- func (t *Temporary) CopyFile(dest, src string) error
- func (t *Temporary) GenerateFile(file string, tpl *template.Template, args interface{}) error
- func (t *Temporary) KeepTempDir(keep bool)
- func (t *Temporary) Reset()
- func (t *Temporary) WriteFile(file string, contents io.Reader) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SourceFile ¶
type Temporary ¶
type Temporary struct { Path string // The path that is appended. Orig string // The original GOPATH Pkg string // The pkg directory Src string // The src directory Bin string // The bin directory // contains filtered or unexported fields }
Temporary is a temporary go source tree. The path is optionally appended to go.build.Default.GOPATH.
func NewTemporary ¶
NewTemporary creates a temporary under the specified directory. If updateGoPath is true, go.build.Default.GOPATH will have this path prefixed to it.
func NewTemporaryWithFiles ¶
func NewTemporaryWithFiles(prefix string, files []SourceFile) (*Temporary, error)
NewTemporaryWithFiles creates a temporary go source tree after copying/creating files. prefix is used to create a temporary directory in which the source tree is created.
func (*Temporary) Copy ¶
func (t *Temporary) Copy(files []SourceFile) error
CopyFiles copies all source files in files using t.CopyFile or t.WriteFile as needed.
func (*Temporary) GenerateFile ¶
GenerateFile is equivalent to calling WriteFile with the results of tpl.Execute(..., args)