Skip to content

Commit 15d897e

Browse files
committed
add: changes with go linters templating
1 parent 018efd4 commit 15d897e

File tree

8 files changed

+38
-8
lines changed

8 files changed

+38
-8
lines changed

templates/rest/chi/cmd/main.go.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"log"
55
"net/http"
66

7-
config "{{.ModuleName}}/internal/config"
8-
routers "{{.ModuleName}}/internal/routers"
7+
"{{.ModuleName}}/internal/config"
8+
"{{.ModuleName}}/internal/router"
99

1010
"github.com/go-chi/chi/v5"
1111
)
@@ -14,7 +14,7 @@ func main() {
1414
cfg := config.Load()
1515

1616
r := chi.NewRouter()
17-
routers.RegisterRoutes(r)
17+
router.RegisterRoutes(r)
1818

1919
port := cfg.Port
2020
if port == "" {

templates/rest/chi/internal/handler/user_handler.go.tmpl

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

33
import (
44
"encoding/json"

templates/rest/chi/internal/routers/routes.go.tmpl renamed to templates/rest/chi/internal/router/routes.go.tmpl

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

33
import (
44
handler "{{.ModuleName}}/internal/handler"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
run:
2+
timeout: 5m
3+
tests: true
4+
5+
linters:
6+
enable:
7+
- govet
8+
- errcheck
9+
- staticcheck
10+
- gofmt
11+
- ineffassign
12+
- unused

templates/rest/gin/Makefile.tmpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
run:
2+
go run ./cmd/server/main.go
3+
4+
build:
5+
go build -o bin/server ./cmd/server/main.go
6+
7+
lint:
8+
golangci-lint run ./...
9+
10+
test:
11+
go test ./...

templates/rest/gin/README.md.tmpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# {{ .ProjectName }}
2+
3+
Generated with go-scaffold (framework: {{ .Framework }}).
4+
5+
## 🚀 Run
6+
```bash
7+
make run

templates/rest/gin/cmd/main.go.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
"log"
5-
"{{ .ModuleName }}/internal/routers"
5+
"{{ .ModuleName }}/internal/router"
66
"{{ .ModuleName }}/internal/config"
77

88
"github.com/gin-gonic/gin"
@@ -16,7 +16,7 @@ func main() {
1616
r := gin.Default()
1717

1818
// Register routes
19-
api.RegisterRoutes(r)
19+
router.RegisterRoutes(r)
2020

2121
// Start server
2222
log.Printf("Server starting on port %s...", cfg.Port)

templates/rest/gin/internal/routers/routes.go.tmpl renamed to templates/rest/gin/internal/router/routes.go.tmpl

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

33
import (
44
"{{ .ModuleName }}/internal/handler"

0 commit comments

Comments
 (0)