Repository navigation
Description
Context
PR #38 resolves scan_targets to go.sum whenever build_type: 'go', unconditionally and without a caller override, matching the legacy Jenkins gerrit-nexus-iq-go-clm job.
Sonatype's guidance has since moved on.
If PR #38 absorbs this before merge, close this issue. It exists so the follow-up is not lost if #38 merges targeting
go.sumonly.
Current vendor guidance
Go Application Analysis, last modified 18 Feb 2026 (checked Aug 2026):
go.list— A customer-generated file containing the output of the go list command. This provides the most accurate results because it reflects the dependencies resolved by the Go tooling during build.
go.sum— Supported, but may include dependencies that are not used by the application.
and:
The recommended approach is to generate a
go.listfile using thego listcommand. This file should be the target for the Lifecycle scan.
The page repeats the point under "reduce Unknown results": "Use a go.list file generated from your build." It also no longer mentions the CycloneDX/SBOM route for Go at all.
Proposal
Make the Go scan target selectable, defaulting to go.list, with go.sum available for projects wanting like-for-like parity with their legacy Jenkins job.
Considerations
-
go list -compiled -depsrequires the project to typecheck, whereas parsinggo.sumdoes not. Combined withcontinue-on-errorfrombuild_permit_fail, a failedgo listleavesgo.listmissing or empty, the scan targets it anyway, and we hit thedocs/BRIEF.mdD12 hazard — a green scan that evaluated nothing.Regardless of which target is chosen, assert the scan target exists and is non-empty before handing it to the scan action, and fail loudly if not, independent of
build_permit_fail. -
It narrows the result set.
go.sumcarries the whole module graph including test-only and unused modules;go list -depscarries only what compiles in. More accurate, but strictly fewer findings than the legacy job produced. Worth stating explicitly rather than discovering during cutover. A-testvariant exists if test-only dependencies are wanted. -
go mod tidybecomes unnecessary ingo.listmode. PR Feat: Add a Go build_type to the Sonatype Lifecycle lane #38 justifiestidyoverdownloadon the grounds that a driftinggo.sumshould fail the scan — sound whilego.sumis the target, but with no force once nothing reads it. Sonatype listsgo mod tidyonly under "Using go.sum for analysis". Consider scoping the step to thego.sumpath so it cannot fail for no benefit. -
Implementation detail: the documented
go listinvocation is a multi-line Go template. Write it via a quoted heredoc rather than inlining it in YAML. The docs'-testexample contains a typo ({{with.Module}}, missing a space) and should not be copy-pasted verbatim. -
Keep targeting the file, not the directory. If both
go.listandgo.sumare present, a directory scan would double-count.
Counter-argument to weigh
Defaulting to go.list means a migrated job produces materially different results from the Jenkins job it replaces, muddying before/after comparison during ONAP cutover. If a clean parity check matters, shipping go.sum as the default and flipping later is legitimate. This repository is pre-1.0, which argues for taking the better default now and leaving parity one input away — but the call belongs to whoever owns the ONAP migration.
Related: PR #38.
Activity
Feat: Add a Go build_type to the Sonatype Lifecycle lane
Feat: Add a Go build_type to the Sonatype Lifecycle lane
Feat: Add a Go build_type to the Sonatype Lifecycle lane
ModeSevenIndustrialSolutions commentedon Aug 18, 2026
Status update from PR #38 (head
cc52d5e).The PR now records the vendor-guidance shift in
docs/BRIEF.mdD20 (dated, with the Go Application Analysis citation) but deliberately keepsgo.sumas the solecli-mode target, deferring the switch here. Agreed on the PR that this is the right split.Direction agreed in the PR discussion (thread):
policy-opa-pdp's caller should explicitly pin the mode/target matching its Jenkins-era results, so the cutover comparison is clean and the goalposts do not move for the project team.go.listin a follow-up PR — this issue.Two implementation notes settled since this issue was filed:
scan_modefor transport), so the target selector here should follow asgo_scan_target: 'list' | 'sum'. The PR intentionally did not pre-add that input with no behaviour behind it; it lands with this change so input and effect ship together.cc52d5emoved the non-empty assertion next to the step that produces each scan target (go.sumafter tidy,bom.xmlafter generation), withcontinue-on-errorremoved from all three Go steps. Thego.listpath should follow the same pattern — generate, then assert non-empty, nocontinue-on-error— and per the PR discussion,go mod tidyshould be scoped away from thelistpath at the same time, since nothing there readsgo.sum.Feat: Add a Go build_type to the Sonatype Lifecycle lane
Feat: Add a Go build_type to the Sonatype Lifecycle lane
Feat: Add a Go build_type to the Sonatype Lifecycle lane
ModeSevenIndustrialSolutions commentedon Aug 28, 2026
Point 1 is already satisfied
The issue asks, "regardless of which target is chosen, assert the scan target exists and is non-empty before handing it to the scan action, and fail loudly if not, independent of
build_permit_fail."The merged Go path does this:
No
continue-on-error, sobuild_permit_failcannot soften it — deliberately, per D20. The SBOM path carries the equivalent guard onbom.xml. The D12 hazard the issue flags is closed for the current target.If
go.listis adopted, the same guard needs extending to it, and that matters more there:go list -compiled -depsrequires the project to typecheck, so it has a failure modego.sumparsing does not.Points 2–5 remain open
The default choice, the narrowing of the result set, scoping
go mod tidyto thego.sumpath, and the heredoc detail are all untouched. So is the counter-argument about muddying the ONAP cutover comparison — and related to that, #50 and #73 now record the migration guidance thatpolicy-opa-pdp's caller should pinscan_modeexplicitly, which is the same "do not move the goalposts mid-cutover" concern in a different input.Worth striking point 1 from the issue body so whoever picks this up does not re-implement a guard that exists.
Checked against
mainat6ee0886, August 2026.ModeSevenIndustrialSolutions commentedon Sep 3, 2026
The blocker on this issue has cleared
This was sequenced behind the ONAP
policy-opa-pdpcutover, per the PR #38 thread: pin the caller explicitly first, flip the default afterwards, so the before-and-after comparison does not move under the project team.That cutover has landed.
onap/policy-opa-pdp/.github/workflows/security-audits.yamlnow calls this lane atv0.5.0withscan_mode: "sbom"set explicitly. Two things follow:The counter-argument in the issue body — that flipping the default muddies the cutover comparison — no longer has a subject.
Addressed in #90
Points 2–5 are all covered: the default moves to
go.listwithgo_scan_target: 'sum'retained for parity,go mod tidyis scoped away from thelistpath, the template goes in via a quoted heredoc, and the target remains a file rather than a directory.Point 1 stays struck, as noted above — the guard already existed. #90 extends it to
go.list, and testing showed the extension is less trivial than it looks (below).Two things testing changed about the design
-testis not optional here. The issue treats it as a variant "if test-only dependencies are wanted", which is how Sonatype's docs present it too. Againstlfreleng-actions/test-go-project, the documented invocation produces a file with no modules in it whatsoever — all four of its external modules are reached only from_test.go:go.sumhas always carried test-only modules. Defaulting to a target that dropped them would have narrowed what CLM evaluates across the estate while presenting as an accuracy improvement, so #90 passes-testin the default path.The non-empty guard needs blank lines stripped or it does nothing. The template emits an empty line per standard-library package. Unfiltered, that same fixture yields a one-byte file of pure newline —
[ -s ]accepts it and the CLI scans a project with no dependencies. Confirmed by running the guard with the filter removed: exit 0, no error raised. Which is to say point 1's guard, extended naively togo.list, would have reintroduced the exact D12 hazard the issue set out to close.Point 2's narrowing also reproduces cleanly on that fixture:
go.sumnames five modules, the build resolves four.gopkg.in/check.v1is present in the checksum file and never reached.Closing when #90 merges.
Fix: Correct the go list contract and its record
ModeSevenIndustrialSolutions commentedon Sep 3, 2026
Correction:
go listdoes not type-checkConsideration 1 in the issue body says:
This is false, and I carried it into #90 before Copilot review prompted me to test it rather than reason about it.
go listloads and resolves packages, so it fails on parse errors, unresolvable imports and missing checksums. Function bodies are never compiled.-compiledpopulates package metadata and implies nothing more.The practical effect is in the change's favour: adopting
go.listadds a narrower failure surface than this issue anticipated. A project that does not compile still produces a complete, correctgo.list, because the module graph does not depend on whether the code type-checks.What does hold is the neighbouring claim, which
go.sumparsing genuinely did not offer:-mod=readonlyis the default from Go 1.16, so an incomplete checksum file fails the step rather than being silently repaired. That is the drift signalgo mod tidywas there to provide, which is what makes scopingtidyaway from this path safe rather than merely tidy.Both results are recorded in
docs/BRIEF.mdD23 under #90, with the distinction spelled out, so the assumption does not get made a third time.Fix: Correct the go list contract and its record
Fix: Correct the go list contract and its record
Fix: Correct the go list contract and its record
Fix: Correct the go list contract and its record
Docs: Add interim evaluation and dev plan
Docs: Add interim evaluation and dev plan