From 3bd7a8fad01b8b5289f93b1fdde455f4657872af Mon Sep 17 00:00:00 2001 From: Mohamed Mahmoud <152813205+Haroka-74@users.noreply.github.com> Date: Thu, 30 Apr 2026 19:08:05 +0300 Subject: [PATCH] fix(i18n): wrap error in loader (#1202) ## What? Replaced the `%v` verb with `%w` in `i18n/loader.go` when returning errors from the embedded loader. ## Why? The current implementation stringifies the underlying `err` using `%v`, which breaks the error chain. This prevents callers from inspecting the root cause using `errors.Is()` or `errors.As()`. Utilizing double `%w` (supported in Go 1.20+) ensures both `ErrLoadFailed` and the original error remain accessible in the error tree. Closes #1051 --- i18n/loader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/loader.go b/i18n/loader.go index d5fb682ac18c861baec91293dc1ae0daf250a05c..885368e543b227d1eb66869ed7c186b097435292 100644 --- a/i18n/loader.go +++ b/i18n/loader.go @@ -13,7 +13,7 @@ import ( func LoadTranslations(bundle *Bundle) error { // Load from embedded files if err := loadFromEmbedded(bundle); err != nil { - return fmt.Errorf("%w: embedded load failed: %v", ErrLoadFailed, err) + return fmt.Errorf("%w: embedded load failed: %w", ErrLoadFailed, err) } return nil