interal/analysis: SkipInit -> SkipModuleInit Readability suggestion from Ethan, thanks! Change-Id: I32e437f70ea7f8cd24d2238bb6bc419cbbb4297f Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/716881 Reviewed-by: Ethan Lee <ethanalee@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/internal/analysis/analysis.go b/internal/analysis/analysis.go index b2f0616..eee5e9e 100644 --- a/internal/analysis/analysis.go +++ b/internal/analysis/analysis.go
@@ -29,28 +29,28 @@ } type ScanParams struct { - Binary string // name of analysis binary to run - BinaryVersion string // hex-encoded binary hash - Args string // command-line arguments to binary; split on whitespace - ImportedBy int // imported-by count of module in path - Insecure bool // if true, run outside sandbox - Serve bool // serve results back to client instead of writing them to BigQuery - JobID string // ID of job, if non-empty - SkipInit bool // if true, do not initialize non-module Go projects - NoDeps bool // if true, do not download module dependencies + Binary string // name of analysis binary to run + BinaryVersion string // hex-encoded binary hash + Args string // command-line arguments to binary; split on whitespace + ImportedBy int // imported-by count of module in path + Insecure bool // if true, run outside sandbox + Serve bool // serve results back to client instead of writing them to BigQuery + JobID string // ID of job, if non-empty + SkipModuleInit bool // if true, do not initialize non-module Go projects + NoDeps bool // if true, do not download module dependencies } type EnqueueParams struct { - Binary string // name of analysis binary to run - Args string // command-line arguments to binary; split on whitespace - Insecure bool // if true, run outside sandbox - Min int32 // minimum import-by count for a module to be included - Max int32 // maximum import-by count for a module to be included - File string // path to file containing modules; if missing, use DB - Suffix string // appended to task queue IDs to generate unique tasks - User string // user initiating enqueue - SkipInit bool // if true, do not initialize non-module Go projects - NoDeps bool // if true, do not download module dependencies + Binary string // name of analysis binary to run + Args string // command-line arguments to binary; split on whitespace + Insecure bool // if true, run outside sandbox + Min int32 // minimum import-by count for a module to be included + Max int32 // maximum import-by count for a module to be included + File string // path to file containing modules; if missing, use DB + Suffix string // appended to task queue IDs to generate unique tasks + User string // user initiating enqueue + SkipModuleInit bool // if true, do not initialize non-module Go projects + NoDeps bool // if true, do not download module dependencies } // Request implements queue.Task so it can be put on a TaskQueue.
diff --git a/internal/worker/analysis.go b/internal/worker/analysis.go index c2656ef..e73bee7 100644 --- a/internal/worker/analysis.go +++ b/internal/worker/analysis.go
@@ -266,7 +266,7 @@ dir: moduleDir, proxyClient: s.proxyClient, insecure: req.Insecure, - init: !req.SkipInit, + init: !req.SkipModuleInit, noDeps: req.NoDeps, } if err := prepareModule(ctx, prepareArgs); err != nil { @@ -442,7 +442,7 @@ func (s *analysisServer) handleEnqueue(w http.ResponseWriter, r *http.Request) (err error) { defer derrors.Wrap(&err, "analysisServer.handleEnqueue") ctx := r.Context() - params := &analysis.EnqueueParams{Min: defaultMinImportedByCount, Max: defaultMaxImportedByCount, SkipInit: false} + params := &analysis.EnqueueParams{Min: defaultMinImportedByCount, Max: defaultMaxImportedByCount, SkipModuleInit: false} if err := scan.ParseParams(r, params); err != nil { return fmt.Errorf("%w: %v", derrors.InvalidArgument, err) } @@ -509,14 +509,14 @@ Version: mod.Version, }, ScanParams: analysis.ScanParams{ - Binary: params.Binary, - BinaryVersion: binaryVersion, - Args: params.Args, - ImportedBy: mod.ImportedBy, - Insecure: params.Insecure, - JobID: jobID, - SkipInit: params.SkipInit, - NoDeps: params.NoDeps, + Binary: params.Binary, + BinaryVersion: binaryVersion, + Args: params.Args, + ImportedBy: mod.ImportedBy, + Insecure: params.Insecure, + JobID: jobID, + SkipModuleInit: params.SkipModuleInit, + NoDeps: params.NoDeps, }, }) }
diff --git a/internal/worker/analysis_test.go b/internal/worker/analysis_test.go index f43b5bb..e071d5f 100644 --- a/internal/worker/analysis_test.go +++ b/internal/worker/analysis_test.go
@@ -139,12 +139,12 @@ req := &analysis.ScanRequest{ ModuleURLPath: scan.ModuleURLPath{Module: modulePath, Version: version}, ScanParams: analysis.ScanParams{ - Binary: "analyzer", - Args: "-name GenerateFromPassword", - Insecure: true, - JobID: "jid", - NoDeps: false, - SkipInit: true, + Binary: "analyzer", + Args: "-name GenerateFromPassword", + Insecure: true, + JobID: "jid", + NoDeps: false, + SkipModuleInit: true, }, } wv := analysis.WorkVersion{BinaryArgs: "-name GenerateFromPassword", BinaryVersion: "bv", SchemaVersion: "sv"}