1 Star 0 Fork 0

Laomo. / golangci-lint

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
varcheck.go 755 Bytes
一键复制 编辑 原始数据 按行查看 历史
package golinters // nolint:dupl
import (
"context"
"fmt"
varcheckAPI "github.com/golangci/check/cmd/varcheck"
"github.com/golangci/golangci-lint/pkg/result"
)
type Varcheck struct{}
func (Varcheck) Name() string {
return "varcheck"
}
func (Varcheck) Desc() string {
return "Finds unused global variables and constants"
}
func (v Varcheck) Run(ctx context.Context, lintCtx *Context) ([]result.Issue, error) {
issues := varcheckAPI.Run(lintCtx.Program, lintCtx.Settings().Varcheck.CheckExportedFields)
var res []result.Issue
for _, i := range issues {
res = append(res, result.Issue{
Pos: i.Pos,
Text: fmt.Sprintf("%s is unused", formatCode(i.VarName, lintCtx.Cfg)),
FromLinter: v.Name(),
})
}
return res, nil
}
1
https://gitee.com/LaomoBK/golangci-lint.git
git@gitee.com:LaomoBK/golangci-lint.git
LaomoBK
golangci-lint
golangci-lint
v1.3.5

搜索帮助

53164aa7 5694891 3bd8fe86 5694891