mirror of
https://github.com/burrowers/garble.git
synced 2025-12-24 12:58:05 +08:00
stop using listedPackage.IgnoredGoFiles
We used it to detect GOOS-specific packages and ignore their load errors
without having to do a substring search.
However, it turns out that repeatedly loading the string slice
from gob files in the cache is rather slow, particularly since many
Go packages have dozens of GOOS-specific files which can be ignored.
│ old │ new │
│ cached-sec/op │ cached-sec/op vs base │
Build-8 340.3m ± 1% 335.8m ± 2% -1.32% (p=0.002 n=10)
│ old │ new │
│ mallocs/op │ mallocs/op vs base │
Build-8 35.73M ± 0% 35.09M ± 0% -1.79% (p=0.000 n=10)
This commit is contained in:
committed by
Paul Scheduikat
parent
8a7d91b684
commit
b38f42da0f
@@ -151,7 +151,6 @@ type listedPackage struct {
|
||||
|
||||
Dir string
|
||||
CompiledGoFiles []string
|
||||
IgnoredGoFiles []string
|
||||
Imports []string
|
||||
|
||||
Error *packageError // to report package loading errors to the user
|
||||
@@ -300,7 +299,7 @@ func appendListedPackages(packages []string, mainBuild bool) error {
|
||||
}
|
||||
|
||||
if perr := pkg.Error; perr != nil {
|
||||
if !mainBuild && len(pkg.CompiledGoFiles) == 0 && len(pkg.IgnoredGoFiles) > 0 {
|
||||
if !mainBuild && strings.Contains(perr.Err, "build constraints exclude all Go files") {
|
||||
// Some packages in runtimeLinknamed need a build tag to be importable,
|
||||
// like crypto/internal/boring/fipstls with boringcrypto,
|
||||
// so any pkg.Error should be ignored when the build tag isn't set.
|
||||
|
||||
Reference in New Issue
Block a user