1
0
mirror of https://github.com/prometheus-community/postgres_exporter.git synced 2025-08-08 04:42:07 +03:00

Update vendored tools/.

This commit is contained in:
Will Rouesnel
2017-08-03 21:19:17 +10:00
parent 1afbd62ab1
commit a7ff84a674
22 changed files with 1452 additions and 1109 deletions

View File

@@ -24,14 +24,14 @@ func (i *ignoredRange) matches(issue *Issue) bool {
return true
}
for _, l := range i.linters {
if l == issue.Linter.Name {
if l == issue.Linter {
return true
}
}
return false
}
func (i *ignoredRange) near(col, start, end int) bool {
func (i *ignoredRange) near(col, start int) bool {
return col == i.col && i.end == start-1
}
@@ -42,15 +42,13 @@ func (ir ignoredRanges) Swap(i, j int) { ir[i], ir[j] = ir[j], ir[i] }
func (ir ignoredRanges) Less(i, j int) bool { return ir[i].end < ir[j].end }
type directiveParser struct {
paths []string
lock sync.Mutex
files map[string]ignoredRanges
fset *token.FileSet
}
func newDirectiveParser(paths []string) *directiveParser {
func newDirectiveParser() *directiveParser {
return &directiveParser{
paths: paths,
files: map[string]ignoredRanges{},
fset: token.NewFileSet(),
}
@@ -92,7 +90,7 @@ func (a *rangeExpander) Visit(node ast.Node) ast.Visitor {
found := sort.Search(len(a.ranges), func(i int) bool {
return a.ranges[i].end+1 >= start
})
if found < len(a.ranges) && a.ranges[found].near(startPos.Column, start, end) {
if found < len(a.ranges) && a.ranges[found].near(startPos.Column, start) {
r := a.ranges[found]
if r.start > start {
r.start = start
@@ -144,12 +142,6 @@ func extractCommentGroupRange(fset *token.FileSet, comments ...*ast.CommentGroup
return
}
func (d *directiveParser) in(n ast.Node, issue *Issue) bool {
start := d.fset.Position(n.Pos())
end := d.fset.Position(n.End())
return issue.Line >= start.Line && issue.Line <= end.Line
}
func filterIssuesViaDirectives(directives *directiveParser, issues chan *Issue) chan *Issue {
out := make(chan *Issue, 1000000)
go func() {