-
Notifications
You must be signed in to change notification settings - Fork 126
Accelerating go-extractor by using 'go list -deps' instead of just 'go list' #554
Conversation
|
Background is that, I hava a project that depends on 980 packages, each time I run [2021-07-25 13:24:58] [build-stderr] 2021/07/25 13:24:58 Running go list.
[2021-07-25 13:51:34] [build-stderr] 2021/07/25 13:51:34 Done running go list, all pkgRoots are:980The log shows that here is the testing code added to log.Printf("Running go list.")
packages.Visit(pkgs, func(pkg *packages.Package) bool {
return true
}, func(pkg *packages.Package) {
if _, ok := pkgRoots[pkg.PkgPath]; !ok {
mdir := util.GetModDir(pkg.PkgPath, modFlags...)
pdir := util.GetPkgDir(pkg.PkgPath, modFlags...)
// GetModDir returns the empty string if the module directory cannot be determined, e.g. if the package
// is not using modules. If this is the case, fall back to the package directory
if mdir == "" {
mdir = pdir
}
pkgRoots[pkg.PkgPath] = mdir
pkgDirs[pkg.PkgPath] = pdir
}
})
log.Printf("Done running go list, all pkgRoots are:%d", len(pkgRoots))With [2021-07-25 13:59:40] [build-stderr] 2021/07/25 13:59:40 Running go list deps.
[2021-07-25 13:59:40] [build-stderr] 2021/07/25 13:59:40 Running cmd: /usr/local/go/bin/go list -e -f {{.ImportPath}}{{"\n"}}{{.Dir}}{{"\n"}}{{if .Module}}{{.Module.Dir}}{{else}}<nil>{{end}} -deps ./...
[2021-07-25 13:59:42] [build-stderr] 2021/07/25 13:59:42 Done running go list deps,resolved 980 packagsjust |
9a5e47e to
40c6288
Compare
47df7d8 to
fe813c3
Compare
|
Test it with a simulated lgtm.com upgrade then merge if good? |
|
@sauyon I shall commit no more changes to it, it's ok to rebase this branch over main. As for the test, I don't know how to do that. |
|
Sounds good, the test is for @sauyon to do |
1a1a7e9 to
4fa6522
Compare
|
@smowton Made some changes based on the LGTM tests; had about 5 projects fail because of a |
|
Looks like there's currently a build failure. Have you manually retested those projects getting a segfault? |
4fa6522 to
09ac73a
Compare
|
This does now appear to work. |
…o list' Change-Id: Icc77214809a0bb8536d751f21194690d58663dc5
09ac73a to
f9ce06b
Compare
Revert "Merge pull request #554 from xhd2015/accelerate_go_list"
Resurrect github/codeql-go#554, but behind an environment variable as to avoid the broken builds noted in github#9304, but still allowing some people to opt in to the much faster approach.
just run
go listonce