diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9c1b38b..075998e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,10 +14,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: ["1.21"] + go: ["1.22"] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} - name: Run tests @@ -27,12 +27,12 @@ jobs: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" cache: false - name: Run lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: - version: v1.54 + version: v1.57 diff --git a/.golangci.yml b/.golangci.yml index 5a41585..60c48d3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,10 +1,6 @@ -run: - skip-dirs: - - .github - linters-settings: gocyclo: - min-complexity: 15 + min-complexity: 18 gofmt: simplify: true misspell: @@ -12,7 +8,6 @@ linters-settings: govet: disable: - shadow - - nilness enable-all: true linters: @@ -21,10 +16,14 @@ linters: - revive - gocyclo - misspell - - bodyclose - govet - unused - errcheck + - exportloopref + - gosimple + - ineffassign + - staticcheck + - testifylint disable-all: false fast: false @@ -32,8 +31,11 @@ issues: exclude-use-default: false max-issues-per-linter: 0 max-same-issues: 0 + exclude-dirs: + - .github exclude: - should have a package comment + - for error assertions use require exclude-rules: - path: _test\.go linters: diff --git a/LICENSE b/LICENSE index 38b6126..56d26be 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Jérémy LAMBERT (SystemGlitch) +Copyright (c) 2024 Jérémy LAMBERT (SystemGlitch) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 3799edd..78ac751 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ A minimal chat application to showcase [Goyave](https://github.com/go-goyave/goy ``` . ├── http -│ ├── controller // Business logic of the application -│ │ └── ... +│ ├── controller +│ │ └── chat // Chat hub implementation │ └── route │ └── route.go // Routes definition │ @@ -46,12 +46,12 @@ Run `go run main.go` in your project's directory to start the server, then open The Goyave framework has an extensive documentation covering in-depth subjects and teaching you how to run a project using Goyave from setup to deployment. -

Read the documentation

+

Read the documentation

pkg.go.dev

## License -This example project is MIT Licensed. Copyright © 2023 Jérémy LAMBERT (SystemGlitch) +This example project is MIT Licensed. Copyright © 2024 Jérémy LAMBERT (SystemGlitch) -The Goyave framework is MIT Licensed. Copyright © 2023 Jérémy LAMBERT (SystemGlitch) +The Goyave framework is MIT Licensed. Copyright © 2024 Jérémy LAMBERT (SystemGlitch) diff --git a/config.example.json b/config.example.json index 18ee467..01344da 100644 --- a/config.example.json +++ b/config.example.json @@ -7,12 +7,8 @@ }, "server": { "host": "127.0.0.1", - "maintenance": false, - "protocol": "http", "domain": "", "port": 8080, - "httpsPort": 8081, - "timeout": 10, "maxUploadSize": 10 } } \ No newline at end of file diff --git a/config.test.json b/config.test.json index 18ee467..01344da 100644 --- a/config.test.json +++ b/config.test.json @@ -7,12 +7,8 @@ }, "server": { "host": "127.0.0.1", - "maintenance": false, - "protocol": "http", "domain": "", "port": 8080, - "httpsPort": 8081, - "timeout": 10, "maxUploadSize": 10 } } \ No newline at end of file diff --git a/go.mod b/go.mod index c236869..522eea0 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module github.com/go-goyave/websocket-example -go 1.21 +go 1.22 require ( github.com/gorilla/websocket v1.5.1 - goyave.dev/goyave/v5 v5.0.0-rc3 + goyave.dev/goyave/v5 v5.0.0-rc9 ) require ( @@ -13,8 +13,8 @@ require ( github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/samber/lo v1.39.0 // indirect - golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect - golang.org/x/net v0.20.0 // indirect - gorm.io/gorm v1.25.5 // indirect + golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect + golang.org/x/net v0.24.0 // indirect + gorm.io/gorm v1.25.9 // indirect goyave.dev/copier v0.4.3 // indirect ) diff --git a/go.sum b/go.sum index 4537585..674bbb9 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,6 @@ github.com/Code-Hex/uniseg v0.2.0 h1:QB/2UJFvEuRLSZqe+Sb1XQBTWjqGVbZoC6oSWzQRKws github.com/Code-Hex/uniseg v0.2.0/go.mod h1:/ndS2tP+X1lk2HUOcXWGtVTxVq0lWilwgMa4CbzdRsg= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= -github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= @@ -12,29 +10,25 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= -github.com/mattn/go-sqlite3 v1.14.19 h1:fhGleo2h1p8tVChob4I9HpmVFIAkKGpiukdrgQbWfGI= -github.com/mattn/go-sqlite3 v1.14.19/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= +github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA= github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e h1:723BNChdd0c2Wk6WOE320qGBiPtYx0F0Bbm1kriShfE= -golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= -golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA= -golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= +golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/driver/sqlite v1.5.4 h1:IqXwXi8M/ZlPzH/947tn5uik3aYQslP9BVveoax0nV0= -gorm.io/driver/sqlite v1.5.4/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed+4= -gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= -gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +gorm.io/driver/sqlite v1.5.5 h1:7MDMtUZhV065SilG62E0MquljeArQZNfJnjd9i9gx3E= +gorm.io/driver/sqlite v1.5.5/go.mod h1:6NgQ7sQWAIFsPrJJl1lSNSu2TABh0ZZ/zm5fosATavE= +gorm.io/gorm v1.25.9 h1:wct0gxZIELDk8+ZqF/MVnHLkA1rvYlBWUMv2EdsK1g8= +gorm.io/gorm v1.25.9/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= goyave.dev/copier v0.4.3 h1:MxX2wBnhQUbv0mHPXEgw/zS4TZMtTVpzj/aYS3h4amk= goyave.dev/copier v0.4.3/go.mod h1:WJu0Ex81v29f5U0eMWzSNsMTGmuGY6lQ/q5yGlyLDsU= -goyave.dev/goyave/v5 v5.0.0-rc2 h1:LkpJmcXI+ianjocIZVidU5dMKLAxOrKGr0e4bg6mNU4= -goyave.dev/goyave/v5 v5.0.0-rc2/go.mod h1:BMWwAkDnb63JVCssMkseLn65RQW3qnpd0ogI/4XvPBg= -goyave.dev/goyave/v5 v5.0.0-rc3 h1:gerRYKFyxXnYd1gCVptc24FJSoEexwbUFa96b51hFZo= -goyave.dev/goyave/v5 v5.0.0-rc3/go.mod h1:U2bVdfdNOdNQGHzz0P05NzXHRQCzgBw92WoVQc1AoJM= +goyave.dev/goyave/v5 v5.0.0-rc9 h1:ffhBWyBkgM6wkdiMtV99x89BGeXqPkWwgqKL6wQ9yiE= +goyave.dev/goyave/v5 v5.0.0-rc9/go.mod h1:WsOPSdVt9PL9d8bxyuU+VhEZ/45GGE8iVJKuimXtldw= diff --git a/http/route/route.go b/http/route/route.go index f3292b2..c23eaa4 100644 --- a/http/route/route.go +++ b/http/route/route.go @@ -13,7 +13,6 @@ import ( // Register all the application routes. This is the main route registrer. func Register(server *goyave.Server, router *goyave.Router) { - router.CORS(cors.Default()) router.GlobalMiddleware(&parse.Middleware{}) router.GlobalMiddleware(log.CombinedLogMiddleware()) diff --git a/main.go b/main.go index d59951c..4b8318e 100644 --- a/main.go +++ b/main.go @@ -17,7 +17,6 @@ import ( var resources embed.FS func main() { - resourcesEmbed := fsutil.NewEmbed(resources) server, err := goyave.New(goyave.Options{})