Skip to content

replace go-multierror with native errors.Join - #3

Merged
lionello merged 1 commit into
DefangLabs:mainfrom
thaJeztah:rm_multierror
Sep 16, 2026
Merged

lionello merged 1 commit into
DefangLabs:mainfrom
thaJeztah:rm_multierror

Conversation

@thaJeztah

Copy link
Copy Markdown

This module has go1.20 as minimum supported Go version, which supports native multi-errors through errors.Join.

This patch replaces uses of go-multierror with native errors.Join to remove some dependencies.

@thaJeztah

Copy link
Copy Markdown
Author

/cc @jordanstephens ptal 🤗

@defangdevs defangdevs left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified this drop-in replacement of go-multierror with stdlib errors.Join:

  • go build ./... and go vet ./pkg/detectors/helpers/... ./pkg/scanner/... are clean on this branch.
  • Ran the full test suite on both main and this branch (go1.26.4) — identical failure set on both (artifactory detector count mismatches, pkg/tests format mismatches, json/yaml transformer nil-handling). These are pre-existing, unrelated to this change, and not introduced by it.
  • The rewrite also fixes two latent bugs in the original code, where multierror.Append(currErr) (single-arg form) only ever kept the last error instead of accumulating — findAll/FindAll in key_value_regex.go and scanString/scanMap in scanner.go now correctly accumulate via errs = append(...) + errors.Join.

No CI is configured on this fork, so this review is manual. LGTM — approving.

@lionello

Copy link
Copy Markdown
Member

@defangdevs rebase

This module has go1.20 as minimum supported Go version, which
supports native multi-errors through errors.Join.

This patch replaces uses of go-multierror with native errors.Join
to remove some dependencies.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@defangdevs

Copy link
Copy Markdown

Rebased onto main (resolved a go.mod conflict — dropped the now-unused hashicorp/errwrap indirect dep, kept main's go-spew/go-difflib indirect deps pulled in by testify). Build passes locally; CI is running now.

@defangdevs

Copy link
Copy Markdown

CI failure (TestTransform/simple_keys in yamltransformer) is pre-existing on main (unrelated to this PR's diff) — already tracked in #6.

@lionello
lionello merged commit 3e28d7e into DefangLabs:main Sep 16, 2026
1 check failed
@thaJeztah
thaJeztah deleted the rm_multierror branch September 16, 2026 19:22
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.

3 participants