代码拉取完成,页面将自动刷新
package reviewdog
import (
"context"
"fmt"
"io"
)
var _ CommentService = &RawCommentWriter{}
// RawCommentWriter is comment writer which writes results to given writer
// without any formatting.
type RawCommentWriter struct {
w io.Writer
}
func NewRawCommentWriter(w io.Writer) *RawCommentWriter {
return &RawCommentWriter{w: w}
}
func (s *RawCommentWriter) Post(_ context.Context, c *Comment) error {
_, err := fmt.Fprintln(s.w, c.Result.Diagnostic.OriginalOutput)
return err
}
var _ CommentService = &UnifiedCommentWriter{}
// UnifiedCommentWriter is comment writer which writes results to given writer
// in one of following unified formats.
//
// Format:
// - <file>: [<tool name>] <message>
// - <file>:<lnum>: [<tool name>] <message>
// - <file>:<lnum>:<col>: [<tool name>] <message>
// where <message> can be multiple lines.
type UnifiedCommentWriter struct {
w io.Writer
}
func NewUnifiedCommentWriter(w io.Writer) *UnifiedCommentWriter {
return &UnifiedCommentWriter{w: w}
}
func (mc *UnifiedCommentWriter) Post(_ context.Context, c *Comment) error {
loc := c.Result.Diagnostic.GetLocation()
s := loc.GetPath()
start := loc.GetRange().GetStart()
if start.GetLine() > 0 {
s += fmt.Sprintf(":%d", start.GetLine())
if start.GetColumn() > 0 {
s += fmt.Sprintf(":%d", start.GetColumn())
}
}
s += fmt.Sprintf(": [%s] %s", c.ToolName, c.Result.Diagnostic.GetMessage())
_, err := fmt.Fprintln(mc.w, s)
return err
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。