From 673b42394ce20eae4389b30eb217a2ab1ab53b7a Mon Sep 17 00:00:00 2001 From: Dan Jones Date: Mon, 27 Mar 2023 20:48:25 -0500 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Anonymous=20structs=20are?= =?UTF-8?q?=20cool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/app.go | 8 +++----- commands/app.go | 4 ---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/app/app.go b/app/app.go index ab07226..4d5ac8f 100644 --- a/app/app.go +++ b/app/app.go @@ -7,10 +7,6 @@ import ( "github.com/gofiber/fiber/v2/middleware/logger" ) -type passReq struct { - Pass string `json:"pass"` -} - func New() *fiber.App { app := fiber.New() conf := config.GetConfig() @@ -31,7 +27,9 @@ func New() *fiber.App { }) app.Post("/check_pass", func(c *fiber.Ctx) error { - req := new(passReq) + req := new(struct { + Pass string `json:"pass"` + }) if err := c.BodyParser(req); err != nil { panic(err) } diff --git a/commands/app.go b/commands/app.go index 226d87c..ed932c5 100644 --- a/commands/app.go +++ b/commands/app.go @@ -6,10 +6,6 @@ import ( "log" ) -type passReq struct { - Pass string `json:"pass"` -} - func run(cmd *cobra.Command, args []string) { app := web.New() log.Fatal(app.Listen(":3000"))