Documentation ¶
Index ¶
- func EnsureDir(dir string) error
- func EnsureFileDir(path string) error
- type GenWriter
- func (g *GenWriter) Buffer() string
- func (g *GenWriter) Close() error
- func (g *GenWriter) EmitHeaderWarning(commentChars string)
- func (g *GenWriter) Flush() error
- func (g *GenWriter) WriteString(msg string)
- func (g *GenWriter) Writefmt(msg string, args ...interface{})
- func (g *GenWriter) Writefmtln(msg string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureDir ¶
EnsureDir ensures that a target directory exists (like `mkdir -p`), returning a non-nil error if any problem occurs.
func EnsureFileDir ¶
EnsureFileDir ensures that a target file's parent directory exists, returning a non-nil error if any problem occurs.
Types ¶
type GenWriter ¶
type GenWriter struct {
// contains filtered or unexported fields
}
GenWriter adds some convenient helpers atop a buffered writer.
func (*GenWriter) Buffer ¶
Buffer returns whatever has been written to the in-memory buffer (in non-file cases).
func (*GenWriter) EmitHeaderWarning ¶
EmitHeaderWarning emits the standard "WARNING" into a generated file, prefixed by commentChars.
func (*GenWriter) WriteString ¶ added in v0.15.1
WriteString writes the provided string to the underlying buffer _without_ formatting it.
func (*GenWriter) Writefmt ¶
Writefmt wraps the bufio.Writer.WriteString function, but also performs fmt.Sprintf-style formatting.
func (*GenWriter) Writefmtln ¶
Writefmtln wraps the bufio.Writer.WriteString function, performing fmt.Sprintf-style formatting and appending \n.