Skip to content

Commit 76047f2

Browse files
committed
chore: isolate code from x/tools
1 parent 2fe04a5 commit 76047f2

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

pkg/goanalysis/runner_action.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -244,17 +244,6 @@ func (act *action) exportPackageFact(fact analysis.Fact) {
244244
act.pkg.Fset.Position(act.pass.Files[0].Pos()), act.pass.Pkg.Path(), fact)
245245
}
246246

247-
func (act *action) allPackageFacts() []analysis.PackageFact {
248-
out := make([]analysis.PackageFact, 0, len(act.packageFacts))
249-
for key, fact := range act.packageFacts {
250-
out = append(out, analysis.PackageFact{
251-
Package: key.pkg,
252-
Fact: fact,
253-
})
254-
}
255-
return out
256-
}
257-
258247
func (act *action) factType(fact analysis.Fact) reflect.Type {
259248
t := reflect.TypeOf(fact)
260249
if t.Kind() != reflect.Ptr {

pkg/goanalysis/runner_base.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,17 @@
66
// FIXME add a commit hash.
77

88
package goanalysis
9+
10+
import "golang.org/x/tools/go/analysis"
11+
12+
// NOTE(ldez) no alteration.
13+
func (act *action) allPackageFacts() []analysis.PackageFact {
14+
out := make([]analysis.PackageFact, 0, len(act.packageFacts))
15+
for key, fact := range act.packageFacts {
16+
out = append(out, analysis.PackageFact{
17+
Package: key.pkg,
18+
Fact: fact,
19+
})
20+
}
21+
return out
22+
}

0 commit comments

Comments
 (0)