1 Star 0 Fork 0

goproxies/github.com-alecthomas-gometalinter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
plumbing.go 699 Bytes
一键复制 编辑 原始数据 按行查看 历史
package output
import (
"fmt"
"io"
"sort"
"github.com/mibk/dupl/syntax"
)
type PlumbingPrinter struct {
*TextPrinter
}
func NewPlumbingPrinter(w io.Writer, fr FileReader) *PlumbingPrinter {
return &PlumbingPrinter{NewTextPrinter(w, fr)}
}
func (p *PlumbingPrinter) Print(dups [][]*syntax.Node) error {
clones, err := p.prepareClonesInfo(dups)
if err != nil {
return err
}
sort.Sort(byNameAndLine(clones))
for i, cl := range clones {
nextCl := clones[(i+1)%len(clones)]
fmt.Fprintf(p.writer, "%s:%d-%d: duplicate of %s:%d-%d\n", cl.filename, cl.lineStart, cl.lineEnd,
nextCl.filename, nextCl.lineStart, nextCl.lineEnd)
}
return nil
}
func (p *PlumbingPrinter) Finish() {}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/goproxies/github.com-alecthomas-gometalinter.git
git@gitee.com:goproxies/github.com-alecthomas-gometalinter.git
goproxies
github.com-alecthomas-gometalinter
github.com-alecthomas-gometalinter
v2.0.1

搜索帮助

0d507c66 1850385 C8b1a773 1850385