Conversation
| - name: Set up Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version: "1.25" |
There was a problem hiding this comment.
| go-version: "1.25" | |
| go-version: "1.25.x" |
| run: go build -v ./... | ||
|
|
||
| - name: Check format | ||
| run: go mod tidy && gofmt -s -w . && git diff --exit-code |
There was a problem hiding this comment.
Maybe easier to use https://github.com/golangci/golangci-lint? It does do even more checks. Example configuration: https://github.com/AikidoSec/firewall-go/blob/main/.golangci.yml
| run: go vet ./... | ||
|
|
||
| - name: Run Tests | ||
| run: go test -v -race -coverprofile=coverage.txt ./... |
There was a problem hiding this comment.
Perhaps nice if it is a separate job? Can of course be changed later.
| - name: Run Tests | ||
| run: go test -v -race -coverprofile=coverage.txt ./... | ||
|
|
||
| frontend: |
There was a problem hiding this comment.
Add to frontend PR later so it does not fail here?
| r.Static("/assets", "./frontend/dist/assets") | ||
| r.StaticFile("/", "./frontend/dist/index.html") | ||
| r.NoRoute(func(c *gin.Context) { | ||
| c.File("./frontend/dist/index.html") |
There was a problem hiding this comment.
The frontend will show a 404 page?
| github.com/gin-gonic/gin v1.11.0 | ||
| github.com/rs/zerolog v1.34.0 | ||
| github.com/spf13/cobra v1.10.2 | ||
| gorm.io/driver/postgres v1.6.0 |
There was a problem hiding this comment.
To discuss: only sqlite or both options?
| if strings.HasPrefix(env, "GIN_MODE=") && strings.Contains(env, "release") { | ||
| return true | ||
| } | ||
| if strings.HasPrefix(env, "LOG_FORMAT=") && strings.Contains(env, "json") { |
There was a problem hiding this comment.
Check LOG_FORMAT before GIN_MODE? Also add support for setting LOG_FORMAT to another value, e.g. plain.
| // ShoudLogJSON checks if JSON logging should be used based on environment variables and command line arguments | ||
| func ShoudLogJSON(environ []string, args []string) bool { | ||
| // Check for production environment | ||
| for _, env := range environ { |
There was a problem hiding this comment.
Why a loop and not LookupEnv?
|
|
||
| // Start server | ||
| addr := fmt.Sprintf(":%s", port) | ||
| fmt.Printf("Server starting on %s\n", addr) |
|
|
||
| func CORS() gin.HandlerFunc { | ||
| return cors.New(cors.Config{ | ||
| AllowOrigins: []string{"*"}, |
There was a problem hiding this comment.
Not really secure? We should only allow the public API later? So that it can only be used with API Keys but never with user cookie.
Just the minimal starter