From e7023adcd4b9f543fc0386e41bf70995e53d051d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E6=B3=BD=E8=BD=A9?= Date: Wed, 21 Feb 2024 11:47:03 +0800 Subject: [PATCH] %w is not supported in api.LogX (#303) The `api.LogX` uses `fmt.Sprintf` under the hover, which doesn't support %w. Signed-off-by: spacewander --- plugins/casbin/filter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/casbin/filter.go b/plugins/casbin/filter.go index 4424c4e8..5239088d 100644 --- a/plugins/casbin/filter.go +++ b/plugins/casbin/filter.go @@ -50,7 +50,7 @@ func (f *filter) DecodeHeaders(headers api.RequestHeaderMap, endStream bool) api e, err := casbin.NewEnforcer(conf.Rule.Model, conf.Rule.Policy) if err != nil { - api.LogErrorf("failed to update Enforcer: %w", err) + api.LogErrorf("failed to update Enforcer: %v", err) // next request will retry } else { conf.lock.Lock() @@ -68,7 +68,7 @@ func (f *filter) DecodeHeaders(headers api.RequestHeaderMap, endStream bool) api if !ok { if err != nil { - api.LogErrorf("failed to enforece %s: %w", role, err) + api.LogErrorf("failed to enforece %s: %v", role, err) } api.LogInfof("reject forbidden user %s", role) return &api.LocalResponse{