Skip to content

Commit 3d8d2d9

Browse files
committed
fiber: makefile and linter
1 parent 4c5ca11 commit 3d8d2d9

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

fiber/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,16 @@ modsync:
1212
docker: modsync
1313
docker build -t echo-demoapp .
1414
docker run --rm -it -p 8080:8080 echo-demoapp:latest
15+
16+
.PHONY: lint
17+
lint:
18+
golangci-lint run ./...
19+
20+
.PHONY: format
21+
format:
22+
find . -type f -name '*.go' -not -path './vendor/*' -exec gofmt -s -w {} +
23+
find . -type f -name '*.go' -not -path './vendor/*' -exec goimports -w {} +
24+
25+
.PHONY: test
26+
test:
27+
go test ./... -race -cover

fiber/internal/app/entities/entities.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ package entities
22

33
type Service interface {
44
List()
5-
}
5+
}

fiber/internal/pkg/http/entities/entities.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ func (eh *entitiesHTTP) list(c *fiber.Ctx) error {
5353
return c.Status(fiber.StatusBadRequest).JSON(errMsg)
5454
}
5555

56-
c.JSON(entities)
57-
return nil
56+
return c.JSON(entities)
5857
}
5958

6059
func (eh *entitiesHTTP) get(c *fiber.Ctx) error {
@@ -70,8 +69,7 @@ func (eh *entitiesHTTP) get(c *fiber.Ctx) error {
7069
return fiber.ErrNotFound
7170
}
7271

73-
c.JSON(entity)
74-
return nil
72+
return c.JSON(entity)
7573
}
7674

7775
func (eh *entitiesHTTP) add(c *fiber.Ctx) error {
@@ -89,8 +87,7 @@ func (eh *entitiesHTTP) add(c *fiber.Ctx) error {
8987
return c.Status(fiber.StatusInternalServerError).JSON(errMsg)
9088
}
9189

92-
c.JSON(entity)
93-
return nil
90+
return c.JSON(entity)
9491
}
9592

9693
func (eh *entitiesHTTP) update(c *fiber.Ctx) error {
@@ -115,8 +112,7 @@ func (eh *entitiesHTTP) update(c *fiber.Ctx) error {
115112
return c.Status(fiber.StatusInternalServerError).JSON(errMsg)
116113
}
117114

118-
c.JSON(entity)
119-
return nil
115+
return c.JSON(entity)
120116
}
121117

122118
func (eh *entitiesHTTP) delete(c *fiber.Ctx) error {
@@ -128,6 +124,5 @@ func (eh *entitiesHTTP) delete(c *fiber.Ctx) error {
128124
return c.Status(fiber.StatusInternalServerError).JSON(errMsg)
129125
}
130126

131-
c.JSON(pkg.TextResponse{Message: "entity deleted"})
132-
return nil
127+
return c.JSON(pkg.TextResponse{Message: "entity deleted"})
133128
}

0 commit comments

Comments
 (0)