Repository navigation
Conversation
ale8k
approved these changes
Oct 22, 2026
There was a problem hiding this comment.
🟡 Changes recommended
The replacement tests need a multiple-wrapped-error regression case to protect the intended fix.
1 open issue
What changed in this PR
This PR delegates Juju’s generic AsType helper to the Go standard library to support error trees containing multiple wrapped errors.
Changes:
- Raises the minimum Go version from 1.18 to 1.26.
- Replaces custom
AsTypetraversal withstderrors.AsType. - Replaces the previous generic-helper tests with Juju wrapper cases.
| File | Description |
|---|---|
go.mod |
Requires Go 1.26 for standard-library AsType. |
functions.go |
Delegates AsType to the standard library and simplifies its documentation. |
functions_test.go |
Replaces existing AsType and HasType coverage with wrapper-focused tests. |
Review effort: Balanced
luci1900
approved these changes
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The Juju errors package introduced a generic
AsTypefunction before it was introduced in Go 1.26. Our implementation didn't cater for multiple wrapped errors e.g. the following test fails,This change updates the go.mod to 1.26 and switches to the stdlib
AsTypeimplementation.Note: I'm not sure which branch this should land in v1/v2/master. Juju currently uses the v1 branch so I've opted for that but
masteris a few commits ahead.