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

Add self-contained gometalinter build tooling.

This commit is contained in:
Will Rouesnel
2017-06-06 21:39:41 +10:00
parent 0de0311c22
commit e2b6c973a1
710 changed files with 277204 additions and 35 deletions

50
tools/vendor/github.com/mvdan/interfacer/cache.go generated vendored Normal file
View File

@@ -0,0 +1,50 @@
// Copyright (c) 2015, Daniel Martí <mvdan@mvdan.cc>
// See LICENSE for licensing information
package interfacer
import (
"go/ast"
"go/types"
)
type pkgTypes struct {
ifaces map[string]string
funcSigns map[string]bool
}
func (p *pkgTypes) getTypes(pkg *types.Package) {
p.ifaces = make(map[string]string)
p.funcSigns = make(map[string]bool)
done := make(map[*types.Package]bool)
addTypes := func(pkg *types.Package, top bool) {
if done[pkg] {
return
}
done[pkg] = true
ifs, funs := fromScope(pkg.Scope())
fullName := func(name string) string {
if !top {
return pkg.Path() + "." + name
}
return name
}
for iftype, name := range ifs {
// only suggest exported interfaces
if ast.IsExported(name) {
p.ifaces[iftype] = fullName(name)
}
}
for ftype := range funs {
// ignore non-exported func signatures too
p.funcSigns[ftype] = true
}
}
for _, imp := range pkg.Imports() {
addTypes(imp, false)
for _, imp2 := range imp.Imports() {
addTypes(imp2, false)
}
}
addTypes(pkg, true)
}