mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-14 20:46:30 +00:00
c28f7cb29f
Initial part of #435
18 lines
300 B
Go
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
|
|
}
|