Documentation
¶
Overview ¶
package builder can be used in testing to create a temporary go module or 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 go module or gopath, src, namespace and package directory, and populate it with source files.
func New ¶
New creates a new temporary location, either for a go module or for a gopath root. See NewGoModule or NewGoRoot for the details. Remember to defer the Cleanup() method to delete the temporary files.
func NewGoModule ¶
NewGoModule creates a new go module root in the system temporary location, creates the root dir and the go.mod file. Remember to defer the Cleanup() method to delete the temporary files.
func NewGoRoot ¶
NewGoRoot 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.