From 5f4baa3ef2214e43e1aa4e1d193f2efdc3dc7542 Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 15 Jul 2024 18:06:13 +0900 Subject: [PATCH] fix: update Locals reference --- .github/workflows/boot-api.test.yaml | 16 ---------------- node/pkg/boot/boot.go | 2 +- node/pkg/boot/peer/controller.go | 3 +-- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/.github/workflows/boot-api.test.yaml b/.github/workflows/boot-api.test.yaml index fb3c1d6bc..8e1ba100b 100644 --- a/.github/workflows/boot-api.test.yaml +++ b/.github/workflows/boot-api.test.yaml @@ -39,22 +39,6 @@ jobs: cache-dependency-path: | ./node/go.sum - - name: Run lint - uses: golangci/golangci-lint-action@v6 - with: - version: v1.54 - working-directory: node/pkg/boot - skip-pkg-cache: true - skip-build-cache: true - args: --timeout=10m - - - name: Run Vet - run: | - cd ./node/pkg/boot - go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest - go vet ./... - go vet -vettool=$(which shadow) ./... - - name: Install golang-migrate run: | curl -L https://github.com/golang-migrate/migrate/releases/download/v4.17.0/migrate.linux-amd64.tar.gz | tar xvz diff --git a/node/pkg/boot/boot.go b/node/pkg/boot/boot.go index d2469e5c9..5feaea6ea 100644 --- a/node/pkg/boot/boot.go +++ b/node/pkg/boot/boot.go @@ -36,7 +36,7 @@ func Run(ctx context.Context) error { } app.Use(func(c *fiber.Ctx) error { - c.Locals("host", &h) + c.Locals("host", h) return c.Next() }) diff --git a/node/pkg/boot/peer/controller.go b/node/pkg/boot/peer/controller.go index 6cc65735f..b91c3e3ad 100644 --- a/node/pkg/boot/peer/controller.go +++ b/node/pkg/boot/peer/controller.go @@ -31,12 +31,11 @@ func sync(c *fiber.Ctx) error { return c.Status(fiber.StatusBadRequest).SendString("Failed to validate request") } - rawHost, ok := c.Locals("host").(*host.Host) + h, ok := c.Locals("host").(host.Host) if !ok { log.Error().Msg("Failed to get host") return c.Status(fiber.StatusInternalServerError).SendString("Failed to get host") } - h := *rawHost defer func() { closeErr := h.Close()