Skip to content

Commit 904d637

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

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

pkg/goanalysis/runner_action.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +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) factType(fact analysis.Fact) reflect.Type {
248-
t := reflect.TypeOf(fact)
249-
if t.Kind() != reflect.Ptr {
250-
act.r.log.Fatalf("invalid Fact type: got %T, want pointer", t)
251-
}
252-
return t
253-
}
254-
255247
func (act *action) markDepsForAnalyzingSource() {
256248
// Horizontal deps (analyzer.Requires) must be loaded from source and analyzed before analyzing
257249
// this action.

pkg/goanalysis/runner_base.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@
77

88
package goanalysis
99

10-
import "golang.org/x/tools/go/analysis"
10+
import (
11+
"reflect"
12+
13+
"golang.org/x/tools/go/analysis"
14+
)
15+
16+
// NOTE(ldez) altered: add receiver to handle logs.
17+
func (act *action) factType(fact analysis.Fact) reflect.Type {
18+
t := reflect.TypeOf(fact)
19+
if t.Kind() != reflect.Ptr {
20+
act.r.log.Fatalf("invalid Fact type: got %T, want pointer", t)
21+
}
22+
return t
23+
}
1124

1225
// NOTE(ldez) no alteration.
1326
func (act *action) allPackageFacts() []analysis.PackageFact {

0 commit comments

Comments
 (0)