Skip to content

fix(go-module-cataloger): use correct error variable in package load #4983

Open
idhyt wants to merge 1 commit into
anchore:mainfrom
idhyt:patch-1
Open

fix(go-module-cataloger): use correct error variable in package load #4983
idhyt wants to merge 1 commit into
anchore:mainfrom
idhyt:patch-1

Conversation

@idhyt

@idhyt idhyt commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Description

In the loop over rootPkgs, the error appended to unknownErr was incorrectly using the outer err (from packages.Load) instead of the individual package error e. This could cause:

  • nil or stale error values to be recorded when package-specific errors existed.
  • Loss of detailed per-package error information in the final error report.

Changed unknown.Append(..., err) to unknown.Append(..., e) to properly capture each package's load error.

Type of change

Checklist

  • I have added unit tests that cover changed behavior
  • I have tested my code in common scenarios and confirmed there are no regressions
  • I have added comments to my code, particularly in hard-to-understand sections

…loop

In the loop over `rootPkgs`, the error appended to `unknownErr` was incorrectly
using the outer `err` (from `packages.Load`) instead of the individual package
error `e`. This could cause:
- nil or stale error values to be recorded when package-specific errors existed.
- Loss of detailed per-package error information in the final error report.

Changed `unknown.Append(..., err)` to `unknown.Append(..., e)` to properly
capture each package's load error.

Signed-off-by: idhyt <idhyt3r@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant