Documentation ¶
Index ¶
- Variables
- func ContainsString(list []string, target string) bool
- func DirExists(filename string) bool
- func Empty(dirname string) bool
- func Exists(filename string) bool
- func ImportPathFromCurrentDir() string
- func InitLogger(basePath string, logLevel logger.LogLevel)
- func MustChmod(filename string, mode os.FileMode)
- func MustCopyDir(destDir, srcDir string, data map[string]interface{}) error
- func MustCopyFile(destFilename, srcFilename string)
- func MustGenerateTemplate(filename, templateSource string, args map[string]interface{}) (err error)
- func MustReadLines(filename string) []string
- func MustRenderTemplate(destPath, srcPath string, data interface{})
- func MustRenderTemplateToStream(output io.Writer, srcPath []string, data interface{})
- func MustTarGzDir(destFilename, srcDir string) string
- func PanicOnError(err error, msg string)
- func ReadLines(filename string) ([]string, error)
- func Retry(format string, args ...interface{})
- func Walk(root string, walkFn filepath.WalkFunc) error
- type Error
- type LoggedError
- type SourceLine
Constants ¶
This section is empty.
Variables ¶
var Logger = logger.New()
Functions ¶
func ContainsString ¶
Return true if the target string is in the list
func ImportPathFromCurrentDir ¶
func ImportPathFromCurrentDir() string
func InitLogger ¶
func MustCopyDir ¶
copyDir copies a directory tree over to a new directory. Any files ending in ".template" are treated as a Go template and rendered using the given data. Additionally, the trailing ".template" is stripped from the file name. Also, dot files and dot directories are skipped.
func MustCopyFile ¶
func MustCopyFile(destFilename, srcFilename string)
func MustGenerateTemplate ¶
GenerateTemplate renders the given template to produce source code, which it writes to the given file.
func MustReadLines ¶
MustReadLines reads the lines of the given file. Panics in the case of error.
func MustRenderTemplate ¶
func MustRenderTemplate(destPath, srcPath string, data interface{})
Given the target path and source path and data. A template
func MustRenderTemplateToStream ¶
Given the target path and source path and data. A template
func MustTarGzDir ¶
Types ¶
type Error ¶
type Error struct { SourceType string // The type of source that failed to build. Title, Path, Description string // Description of the error, as presented to the user. Line, Column int // Where the error was encountered. SourceLines []string // The entire source file, split into lines. Stack string // The raw stack trace string from debug.Stack(). MetaError string // Error that occurred producing the error page. Link string // A configurable link to wrap the error source in }
The error is a wrapper for the
func (*Error) ContextSource ¶
func (e *Error) ContextSource() []SourceLine
ContextSource method returns a snippet of the source around where the error occurred.
type LoggedError ¶
type LoggedError struct {
// contains filtered or unexported fields
}
func NewLoggedError ¶
func NewLoggedError(err error) *LoggedError
type SourceLine ¶
SourceLine structure to hold the per-source-line details.