Skip to content

Fix base-lint staticcheck SA5011 in sbom-builder tests#13523

Closed
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-base-lint-job
Closed

Fix base-lint staticcheck SA5011 in sbom-builder tests#13523
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-base-lint-job

Conversation

Copilot AI commented Jun 5, 2026

Copy link
Copy Markdown

The base-lint GitHub Actions job failed in lint-go-tools due to staticcheck (SA5011) reporting possible nil dereferences in tools/sbom-builder/main_test.go. This update makes the nil-guard control flow explicit so the test code passes static analysis.

  • Root cause in test assertions

    • findPackage(...) results were nil-checked with t.Fatalf(...), but staticcheck still flagged subsequent field access as potentially unsafe.
  • Targeted test-only control-flow fix

    • Added explicit return immediately after the two t.Fatalf(...) nil checks:
      • TestAddOSPackage_AddsSiblingWithRefs
      • TestAddGoModulePackage
    • No production code or runtime behavior changes.
  • Illustrative diff pattern

    if goPkg == nil {
        t.Fatalf("expected Package-go-siderolabs-talos to be added, got: %v", packageIDs(doc))
        return
    }

Copilot AI changed the title [WIP] Fix failing GitHub Actions job base-lint Fix base-lint staticcheck SA5011 in sbom-builder tests Jun 5, 2026
Copilot finished work on behalf of frezbo June 5, 2026 11:53
Copilot AI requested a review from frezbo June 5, 2026 11:53
Copilot finished work on behalf of frezbo June 5, 2026 11:55
@smira smira closed this Jun 8, 2026
@smira smira deleted the copilot/fix-base-lint-job branch June 8, 2026 10:13
@github-project-automation github-project-automation Bot moved this from To Do to Done in Planning Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants