Merge pull request 'chore(deps): update golangci/golangci-lint-action action to v7' (#4) from renovate/golangci-golangci-lint-action-7.x into main
All checks were successful
Build / build (push) Successful in 1m18s
Lint / lint (push) Successful in 2m8s

Reviewed-on: #4
This commit is contained in:
vbrandl 2025-04-09 14:49:33 +02:00
commit a720477b16
7 changed files with 20 additions and 10 deletions

View File

@ -15,6 +15,6 @@ jobs:
with: with:
go-version-file: 'go.mod' go-version-file: 'go.mod'
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v6 uses: golangci/golangci-lint-action@v7
with: with:
version: 'latest' version: 'latest'

View File

@ -15,8 +15,8 @@ const (
) )
type Timing struct { type Timing struct {
TimeMillis time.Duration `json:"timeMillis"` ExecutionTime time.Duration `json:"executionTime"`
Source string `json:"source"` Source string `json:"source"`
} }
type HealthCheckResult struct { type HealthCheckResult struct {
@ -43,8 +43,8 @@ func (app *Application) HealthCheck(w http.ResponseWriter, r *http.Request) {
Time: time.Now().UTC(), Time: time.Now().UTC(),
Timing: []Timing{ Timing: []Timing{
{ {
Source: "HealthCheck", Source: "HealthCheck",
TimeMillis: time.Since(start), ExecutionTime: time.Since(start),
}, },
}, },
Response: HealthCheckResponse{ Response: HealthCheckResponse{

View File

@ -13,7 +13,7 @@ func (app *Application) Index(w http.ResponseWriter, r *http.Request) {
reqId := RequestID(r) reqId := RequestID(r)
err := indexTemplate.Execute(w, templateData{ err := indexTemplate.Execute(w, templateData{
RequestID: reqId, RequestID: reqId,
}) })
if err != nil { if err != nil {
l.Error().Err(err).Msg("error executing template") l.Error().Err(err).Msg("error executing template")

View File

@ -1,6 +1,7 @@
package handlers_test package handlers_test
import ( import (
"fmt"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"testing" "testing"
@ -35,7 +36,11 @@ func TestIndex(t *testing.T) {
app.Handler().ServeHTTP(w, req) app.Handler().ServeHTTP(w, req)
// app.Index(w, req) // app.Index(w, req)
res := w.Result() res := w.Result()
defer res.Body.Close() defer func() {
if err := res.Body.Close(); err != nil {
fmt.Println("Received error: ", err)
}
}()
if res.StatusCode != 200 { if res.StatusCode != 200 {
t.Errorf("expected status to be 200, got %d", res.StatusCode) t.Errorf("expected status to be 200, got %d", res.StatusCode)

View File

@ -14,7 +14,7 @@ func (app *Application) NotFound(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound) w.WriteHeader(http.StatusNotFound)
err := notFoundTemplate.Execute(w, templateData{ err := notFoundTemplate.Execute(w, templateData{
RequestID: reqId, RequestID: reqId,
}) })
if err != nil { if err != nil {
l.Error().Err(err).Msg("error executing template") l.Error().Err(err).Msg("error executing template")

View File

@ -1,6 +1,7 @@
package handlers_test package handlers_test
import ( import (
"fmt"
"io" "io"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
@ -16,7 +17,11 @@ func TestNotFound(t *testing.T) {
app.Handler().ServeHTTP(w, req) app.Handler().ServeHTTP(w, req)
res := w.Result() res := w.Result()
defer res.Body.Close() defer func() {
if err := res.Body.Close(); err != nil {
fmt.Println("Received error: ", err)
}
}()
if res.StatusCode != 404 { if res.StatusCode != 404 {
t.Errorf("expected status to be 404, got %d", res.StatusCode) t.Errorf("expected status to be 404, got %d", res.StatusCode)

View File

@ -10,7 +10,7 @@ var indexTemplate *template.Template
var notFoundTemplate *template.Template var notFoundTemplate *template.Template
type templateData struct { type templateData struct {
RequestID string RequestID string
} }
func (app *Application) ParseTemplates() error { func (app *Application) ParseTemplates() error {