Documentation ¶
Overview ¶
Package writer provides error result writers.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckStyle ¶
type CheckStyle struct {
// contains filtered or unexported fields
}
CheckStyle represents checkstyle XML writer. http://checkstyle.sourceforge.net/
Example ¶
w := NewCheckStyle(os.Stdout) for _, e := range errors { w.Write(e) } w.Flush()
Output: <?xml version="1.0" encoding="UTF-8"?> <checkstyle version="1.0"> <file name="file2"> <error column="14" line="2" message="emacs" severity="error 1" source="E1"></error> <error column="1" line="14" message="neovim" severity="error 14" source="E14"></error> </file> <file name="path/to/file1"> <error column="14" line="1" message="hello" severity="warning"></error> <error column="14" line="2" message="vim" severity="info"></error> </file> </checkstyle>
func NewCheckStyle ¶
func NewCheckStyle(w io.Writer) *CheckStyle
func (*CheckStyle) Flush ¶
func (c *CheckStyle) Flush() error
func (*CheckStyle) Write ¶
func (c *CheckStyle) Write(e *errorformat.Entry) error
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
Template represents text/template based writer.
Example (More) ¶
tmpl, _ := template.New("example").Parse("file:{{.Filename}}\tline:{{.Lnum}}\tcol:{{.Col}}\tmes:{{.Text}}") w := NewTemplate(tmpl, os.Stdout) for _, e := range errors { w.Write(e) }
Output: file:path/to/file1 line:1 col:14 mes:hello file:path/to/file1 line:2 col:14 mes:vim file:file2 line:2 col:14 mes:emacs file:file2 line:14 col:1 mes:neovim
Example (String) ¶
tmpl, _ := template.New("example").Parse("{{.String}}") w := NewTemplate(tmpl, os.Stdout) for _, e := range errors { w.Write(e) }
Output: path/to/file1|1 col 14 warning| hello path/to/file1|2 col 14 info| vim file2|2 col 14 error 1| emacs file2|14 col 1 error 14| neovim
type Writer ¶
type Writer interface {
Write(*errorformat.Entry) error
}
Writer represents error result writer.
Click to show internal directories.
Click to hide internal directories.