Compare commits

...

6 Commits

Author SHA1 Message Date
Renovate Bot
49ae3edfc4 fix(deps): update module github.com/rs/zerolog to v1.34.0
All checks were successful
Build / build (pull_request) Successful in 1m23s
Lint / lint (pull_request) Successful in 2m0s
2025-04-09 12:51:21 +00:00
a720477b16 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
2025-04-09 14:49:33 +02:00
5a03c74642
Fix lints
All checks were successful
Build / build (pull_request) Successful in 1m18s
Lint / lint (pull_request) Successful in 2m9s
2025-04-09 14:47:05 +02:00
f8ae841245 Merge pull request 'fix(deps): update module github.com/pelletier/go-toml/v2 to v2.2.4' (#5) from renovate/github.com-pelletier-go-toml-v2-2.x into main
All checks were successful
Build / build (push) Successful in 1m30s
Lint / lint (push) Successful in 2m23s
Reviewed-on: #5
2025-04-09 14:14:48 +02:00
Renovate Bot
6a710bf751 fix(deps): update module github.com/pelletier/go-toml/v2 to v2.2.4
All checks were successful
Build / build (pull_request) Successful in 1m45s
Lint / lint (pull_request) Successful in 2m21s
2025-04-08 07:03:14 +00:00
Renovate Bot
0f7fcaffdb chore(deps): update golangci/golangci-lint-action action to v7
Some checks failed
Build / build (pull_request) Successful in 1m42s
Lint / lint (pull_request) Failing after 2m9s
2025-04-01 07:02:30 +00:00
9 changed files with 29 additions and 13 deletions

View File

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

6
go.mod
View File

@ -5,13 +5,13 @@ go 1.22.6
require (
github.com/gorilla/mux v1.8.1
github.com/justinas/alice v1.2.0
github.com/pelletier/go-toml/v2 v2.2.3
github.com/rs/zerolog v1.33.0
github.com/pelletier/go-toml/v2 v2.2.4
github.com/rs/zerolog v1.34.0
)
require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/rs/xid v1.6.0 // indirect
golang.org/x/sys v0.12.0 // indirect
)

6
go.sum
View File

@ -11,11 +11,17 @@ github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APP
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU=
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=

View File

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

View File

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

View File

@ -1,6 +1,7 @@
package handlers_test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
@ -35,7 +36,11 @@ func TestIndex(t *testing.T) {
app.Handler().ServeHTTP(w, req)
// app.Index(w, req)
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 {
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)
err := notFoundTemplate.Execute(w, templateData{
RequestID: reqId,
RequestID: reqId,
})
if err != nil {
l.Error().Err(err).Msg("error executing template")

View File

@ -1,6 +1,7 @@
package handlers_test
import (
"fmt"
"io"
"net/http"
"net/http/httptest"
@ -16,7 +17,11 @@ func TestNotFound(t *testing.T) {
app.Handler().ServeHTTP(w, req)
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 {
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
type templateData struct {
RequestID string
RequestID string
}
func (app *Application) ParseTemplates() error {