diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 839c32a..f5ca389 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -30,7 +30,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21.1' + go-version: '1.23.2' - name: Get changed src code id: changed-files diff --git a/go.mod b/go.mod index 026c085..af810cc 100644 --- a/go.mod +++ b/go.mod @@ -1,16 +1,16 @@ module github.com/juan131/api-mock -go 1.21.1 +go 1.23.2 require ( - github.com/go-chi/chi v1.5.5 + github.com/go-chi/chi/v5 v5.1.0 github.com/go-chi/cors v1.2.1 - github.com/go-chi/httprate v0.7.4 + github.com/go-chi/httprate v0.14.0 github.com/go-chi/render v1.0.3 github.com/google/go-cmp v0.6.0 ) require ( github.com/ajg/form v1.5.1 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect ) diff --git a/go.sum b/go.sum index 50e9d64..e8a4bc1 100644 --- a/go.sum +++ b/go.sum @@ -1,14 +1,16 @@ github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/go-chi/chi v1.5.5 h1:vOB/HbEMt9QqBqErz07QehcOKHaWFtuj87tTDVz2qXE= -github.com/go-chi/chi v1.5.5/go.mod h1:C9JqLr3tIYjDOZpzn+BCuxY8z8vmca43EeMgyZt7irw= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw= +github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4= github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= -github.com/go-chi/httprate v0.7.4 h1:a2GIjv8he9LRf3712zxxnRdckQCm7I8y8yQhkJ84V6M= -github.com/go-chi/httprate v0.7.4/go.mod h1:6GOYBSwnpra4CQfAKXu8sQZg+nZ0M1g9QnyFvxrAB8A= +github.com/go-chi/httprate v0.14.0 h1:c8szLJc+Gn+1EC1jjv3q88Om4a9USAqU9lL8wQFVX2M= +github.com/go-chi/httprate v0.14.0/go.mod h1:TUepLXaz/pCjmCtf/obgOQJ2Sz6rC8fSf5cAt5cnTt0= github.com/go-chi/render v1.0.3 h1:AsXqd2a1/INaIfUSKq3G5uA8weYx20FOsM7uSoCyyt4= github.com/go-chi/render v1.0.3/go.mod h1:/gr3hVkmYR0YlEy3LxCuVRFzEu9Ruok+gFqbIofjao0= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= diff --git a/internal/service/router.go b/internal/service/router.go index 88cecc9..8b59947 100644 --- a/internal/service/router.go +++ b/internal/service/router.go @@ -4,8 +4,8 @@ import ( "net/http" "time" - "github.com/go-chi/chi" - "github.com/go-chi/chi/middleware" + "github.com/go-chi/chi/v5" + "github.com/go-chi/chi/v5/middleware" "github.com/go-chi/cors" "github.com/go-chi/httprate" "github.com/go-chi/render" diff --git a/internal/service/service.go b/internal/service/service.go index 9483a8b..562e056 100644 --- a/internal/service/service.go +++ b/internal/service/service.go @@ -11,7 +11,7 @@ import ( "syscall" "time" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v5" ) const gracefulPeriod = time.Second * 30 @@ -57,7 +57,7 @@ func (svc *service) ListenAndServe() { } svc.logger.Info(fmt.Sprintf("service attempting to listen on port %d", svc.cfg.port)) if err := svc.listenAndShutdown(srv); err != nil { - svc.logger.Error("server error", err) + svc.logger.Error("server error", "error", err) os.Exit(1) } } @@ -88,7 +88,7 @@ func (svc *service) listenAndShutdown(server *http.Server) error { go func() { if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed { - svc.logger.Error("fail on listen", err) + svc.logger.Error("fail on listen", "error", err) os.Exit(1) } }() diff --git a/pkg/authn/authn_test.go b/pkg/authn/authn_test.go index 393814d..0dbbf95 100644 --- a/pkg/authn/authn_test.go +++ b/pkg/authn/authn_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "testing" - "github.com/go-chi/chi" + "github.com/go-chi/chi/v5" ) const defaultKey string = "some-key"