You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.sum only.
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.list file using the go list command. 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 -deps requires the project to typecheck, whereas parsing go.sum does not. Combined with continue-on-error from build_permit_fail, a failed go list leaves go.list missing or empty, the scan targets it anyway, and we hit the docs/BRIEF.md D12 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.sum carries the whole module graph including test-only and unused modules; go list -deps carries only what compiles in. More accurate, but strictly fewer findings than the legacy job produced. Worth stating explicitly rather than discovering during cutover. A -test variant exists if test-only dependencies are wanted.
go mod tidy becomes unnecessary in go.list mode. PR Feat: Add a Go build_type to the Sonatype Lifecycle lane #38 justifies tidy over download on the grounds that a drifting go.sum should fail the scan — sound while go.sum is the target, but with no force once nothing reads it. Sonatype lists go mod tidy only under "Using go.sum for analysis". Consider scoping the step to the go.sum path so it cannot fail for no benefit.
Implementation detail: the documented go list invocation is a multi-line Go template. Write it via a quoted heredoc rather than inlining it in YAML. The docs' -test example 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.list and go.sum are 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.
Context
PR #38 resolves
scan_targetstogo.sumwheneverbuild_type: 'go', unconditionally and without a caller override, matching the legacy Jenkinsgerrit-nexus-iq-go-clmjob.Sonatype's guidance has since moved on.
Current vendor guidance
Go Application Analysis, last modified 18 Feb 2026 (checked Aug 2026):
and:
The page repeats the point under "reduce Unknown results": "Use a
go.listfile 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, withgo.sumavailable 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.listmeans 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, shippinggo.sumas 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.