woodpecker/vendor/github.com/gostaticanalysis/analysisutil/file.go
Lukas c28f7cb29f
Add golangci-lint (#502)
Initial part of #435
2021-11-14 21:01:54 +01:00

18 lines
300 B
Go

package analysisutil
import (
"go/ast"
"go/token"
"golang.org/x/tools/go/analysis"
)
// File finds *ast.File in pass.Files by pos.
func File(pass *analysis.Pass, pos token.Pos) *ast.File {
for _, f := range pass.Files {
if f.Pos() <= pos && pos <= f.End() {
return f
}
}
return nil
}