From 4581b0195cb6ce508775a3819b31816cf58d2a9a Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Thu, 20 Jan 2022 16:29:06 +0000 Subject: [PATCH] Autofix issues in 2 files Resolved issues in the following files via DeepSource Autofix: 1. internal/endpoints/consent/pkg/capability.go 2. internal/utils/logger/smartlogger.go --- internal/endpoints/consent/pkg/capability.go | 4 +--- internal/utils/logger/smartlogger.go | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/internal/endpoints/consent/pkg/capability.go b/internal/endpoints/consent/pkg/capability.go index c850ae51..c05eeb93 100644 --- a/internal/endpoints/consent/pkg/capability.go +++ b/internal/endpoints/consent/pkg/capability.go @@ -96,9 +96,7 @@ func searchCapability(name string, searchParent bool) *WebCapability { return searchCapabilityS(allWebCapabilities, name, searchParent) } func searchCapabilityS(slice []*WebCapability, name string, searchParent bool) *WebCapability { - if strings.HasPrefix(name, api.CapabilityReadOnlyPrefix) { - name = name[len(api.CapabilityReadOnlyPrefix):] - } + name = strings.TrimPrefix(name, api.CapabilityReadOnlyPrefix) for _, c := range slice { if !searchParent && c.ReadWriteCapability.Name == name { return c diff --git a/internal/utils/logger/smartlogger.go b/internal/utils/logger/smartlogger.go index 8d3490df..c9913c75 100644 --- a/internal/utils/logger/smartlogger.go +++ b/internal/utils/logger/smartlogger.go @@ -28,7 +28,7 @@ type rootHook struct { error *errorHook } -func (h *rootHook) Levels() []log.Level { +func (*rootHook) Levels() []log.Level { return log.AllLevels } func (h *rootHook) Fire(e *log.Entry) error { @@ -51,7 +51,7 @@ type errorHook struct { file io.Writer } -func (h *errorHook) Levels() []log.Level { +func (*errorHook) Levels() []log.Level { return log.AllLevels // we must be triggered at } func (h *errorHook) Fire(e *log.Entry) (err error) { -- GitLab