Skip to content

Commit

Permalink
fix: update Locals reference
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Jul 15, 2024
1 parent f76efa2 commit 5f4baa3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 19 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/boot-api.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion node/pkg/boot/boot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})

Expand Down
3 changes: 1 addition & 2 deletions node/pkg/boot/peer/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5f4baa3

Please sign in to comment.