mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Drop unused escapes information.
PiperOrigin-RevId: 367517305
This commit is contained in:
committed by
gVisor bot
parent
ffeb2a2f54
commit
5ac79e1545
@@ -83,11 +83,6 @@ var AllAnalyzers = []*analysis.Analyzer{
|
||||
checklocks.Analyzer,
|
||||
}
|
||||
|
||||
// EscapeAnalyzers is a list of escape-related analyzers.
|
||||
var EscapeAnalyzers = []*analysis.Analyzer{
|
||||
checkescape.EscapeAnalyzer,
|
||||
}
|
||||
|
||||
func register(all []*analysis.Analyzer) {
|
||||
// Register all fact types.
|
||||
//
|
||||
@@ -129,5 +124,4 @@ func init() {
|
||||
|
||||
// Register lists.
|
||||
register(AllAnalyzers)
|
||||
register(EscapeAnalyzers)
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ var (
|
||||
stdlibFile = flag.String("stdlib", "", "stdlib configuration file (in JSON format)")
|
||||
findingsOutput = flag.String("findings", "", "output file (or stdout, if not specified)")
|
||||
factsOutput = flag.String("facts", "", "output file for facts (optional)")
|
||||
escapesOutput = flag.String("escapes", "", "output file for escapes (optional)")
|
||||
)
|
||||
|
||||
func loadConfig(file string, config interface{}) interface{} {
|
||||
@@ -66,25 +65,13 @@ func main() {
|
||||
|
||||
// Run the configuration.
|
||||
if *stdlibFile != "" {
|
||||
// Perform basic analysis.
|
||||
// Perform stdlib analysis.
|
||||
c := loadConfig(*stdlibFile, new(nogo.StdlibConfig)).(*nogo.StdlibConfig)
|
||||
findings, factData, err = nogo.CheckStdlib(c, nogo.AllAnalyzers)
|
||||
|
||||
} else if *packageFile != "" {
|
||||
// Perform basic analysis.
|
||||
// Perform standard analysis.
|
||||
c := loadConfig(*packageFile, new(nogo.PackageConfig)).(*nogo.PackageConfig)
|
||||
findings, factData, err = nogo.CheckPackage(c, nogo.AllAnalyzers, nil)
|
||||
|
||||
// Do we need to do escape analysis?
|
||||
if *escapesOutput != "" {
|
||||
escapes, _, err := nogo.CheckPackage(c, nogo.EscapeAnalyzers, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("error performing escape analysis: %v", err)
|
||||
}
|
||||
if err := nogo.WriteFindingsToFile(escapes, *escapesOutput); err != nil {
|
||||
log.Fatalf("error writing escapes to %q: %v", *escapesOutput, err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.Fatalf("please provide at least one of package or stdlib!")
|
||||
}
|
||||
|
||||
+1
-7
@@ -280,7 +280,6 @@ def _nogo_aspect_impl(target, ctx):
|
||||
go_ctx = go_context(ctx, goos = nogo_target_info.goos, goarch = nogo_target_info.goarch)
|
||||
facts = ctx.actions.declare_file(target.label.name + ".facts")
|
||||
raw_findings = ctx.actions.declare_file(target.label.name + ".raw_findings")
|
||||
escapes = ctx.actions.declare_file(target.label.name + ".escapes")
|
||||
config = struct(
|
||||
ImportPath = importpath,
|
||||
GoFiles = [src.path for src in srcs if src.path.endswith(".go")],
|
||||
@@ -297,7 +296,7 @@ def _nogo_aspect_impl(target, ctx):
|
||||
inputs.append(config_file)
|
||||
ctx.actions.run(
|
||||
inputs = inputs,
|
||||
outputs = [facts, raw_findings, escapes],
|
||||
outputs = [facts, raw_findings],
|
||||
tools = depset(go_ctx.runfiles.to_list() + ctx.files._nogo_objdump_tool),
|
||||
executable = ctx.files._nogo_check[0],
|
||||
mnemonic = "NogoAnalysis",
|
||||
@@ -308,7 +307,6 @@ def _nogo_aspect_impl(target, ctx):
|
||||
"-package=%s" % config_file.path,
|
||||
"-findings=%s" % raw_findings.path,
|
||||
"-facts=%s" % facts.path,
|
||||
"-escapes=%s" % escapes.path,
|
||||
],
|
||||
)
|
||||
|
||||
@@ -330,10 +328,6 @@ def _nogo_aspect_impl(target, ctx):
|
||||
srcs = srcs,
|
||||
deps = deps,
|
||||
),
|
||||
# Make the escapes data visible to go/tricorder. This is returned here
|
||||
# and not in the nogo_test rule so that this output can be obtained for
|
||||
# ordinary go_* rules by using this as a command-line aspect.
|
||||
OutputGroupInfo(tricorder = [escapes]),
|
||||
]
|
||||
|
||||
nogo_aspect = go_rule(
|
||||
|
||||
Reference in New Issue
Block a user