From 92dd8d691702ba4628a4b5f326c7fb31d93714d8 Mon Sep 17 00:00:00 2001 From: nickajacks1 <128185314+nickajacks1@users.noreply.github.com> Date: Sat, 10 Feb 2024 13:36:49 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Style:=20Add=20inamedparam=20lin?= =?UTF-8?q?ter=20(#2848)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit inamedparam enforces that parameters in interface definitions be named. This is important for clarity so that users and implementers can easily understand the purpose of each parameter. --- .golangci.yml | 2 +- bind.go | 4 ++-- ctx.go | 2 +- log/log.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 3ef22c9e846..50b6c3d54fa 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -191,7 +191,7 @@ linters: # - gosmopolitan # TODO https://github.com/gofiber/fiber/issues/2816 - govet - grouper - # - inamedparam # TODO https://github.com/gofiber/fiber/issues/2816 + - inamedparam - loggercheck # - mirror # TODO https://github.com/gofiber/fiber/issues/2816 - misspell diff --git a/bind.go b/bind.go index ab3594944f0..0c9a63c4a8f 100644 --- a/bind.go +++ b/bind.go @@ -9,13 +9,13 @@ import ( type CustomBinder interface { Name() string MIMETypes() []string - Parse(Ctx, any) error + Parse(c Ctx, out any) error } // An interface to register custom struct validator for binding. type StructValidator interface { Engine() any - ValidateStruct(any) error + ValidateStruct(out any) error } // Bind struct diff --git a/ctx.go b/ctx.go index d58ef263b7e..5421674276c 100644 --- a/ctx.go +++ b/ctx.go @@ -105,7 +105,7 @@ type Cookie struct { // Views is the interface that wraps the Render function. type Views interface { Load() error - Render(io.Writer, string, any, ...string) error + Render(out io.Writer, name string, binding any, layout ...string) error } // ResFmt associates a Content Type to a fiber.Handler for c.Format diff --git a/log/log.go b/log/log.go index 11698135cff..9d9cd8b0d2f 100644 --- a/log/log.go +++ b/log/log.go @@ -54,8 +54,8 @@ type CommonLogger interface { // ControlLogger provides methods to config a logger. type ControlLogger interface { - SetLevel(Level) - SetOutput(io.Writer) + SetLevel(level Level) + SetOutput(w io.Writer) } // AllLogger is the combination of Logger, FormatLogger, CtxLogger and ControlLogger.