staticcheck: add back concurrency to Init
Instead of fine-grained concurency in the deprecation detection, use
course concurrency for the three independent phases of initialisation.
@@ -13,6 +13,7 @@ import (
"sort"
"strconv"
"strings"
+ "sync"
texttemplate "text/template"
"honnef.co/go/tools/functions"
@@ -317,19 +318,26 @@ func (c *Checker) deprecateObject(m map[types.Object]string, prog *lint.Program,
}
func (c *Checker) Init(prog *lint.Program) {
+ wg := &sync.WaitGroup{}
+ wg.Add(3)
+ go func() {
c.funcDescs = functions.NewDescriptions(prog.SSA)
- c.deprecatedObjs = map[types.Object]string{}
- c.nodeFns = map[ast.Node]*ssa.Function{}
-
for _, fn := range prog.AllFunctions {
if fn.Blocks != nil {
applyStdlibKnowledge(fn)
ssa.OptimizeBlocks(fn)
}
}
+ wg.Done()
+ }()
+ go func() {
c.nodeFns = lint.NodeFns(prog.Packages)
+ wg.Done()
+ }()
+ go func() {
+ c.deprecatedObjs = map[types.Object]string{}
for _, ssapkg := range prog.SSA.AllPackages() {
ssapkg := ssapkg
for _, member := range ssapkg.Members {
@@ -362,6 +370,10 @@ func (c *Checker) Init(prog *lint.Program) {
}
}
}
+ wg.Done()
+ }()
+
+ wg.Wait()
}
func (c *Checker) deprecationMessage(file *ast.File, fset *token.FileSet, obj types.Object) (message string) {
