Skip to content

Commit

Permalink
Update to Go 1.23 (#73)
Browse files Browse the repository at this point in the history
CubicrootXYZ authored Oct 20, 2024

Unverified

This user has not yet uploaded their public signing key.
1 parent 35f9573 commit 15ea293
Showing 14 changed files with 139 additions and 162 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ on:
- 'v[0-9]+.[0-9]+.[0-9]+'

env:
GO_VERSION: '1.21.5'
GO_VERSION: '1.23.2'
PB_BUILD_VERSION: unknown # Needed for using Make targets.
SSH_AUTH_SOCK: /tmp/ssh_agent.sock

2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ on:
- 'v[0-9]+.[0-9]+.[0-9]+'

env:
GO_VERSION: '1.21.5'
GO_VERSION: '1.23.2'

jobs:
test:
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ on:
- 'main'

env:
GO_VERSION: '1.21.5'
GO_VERSION: '1.23.2'
PB_BUILD_VERSION: pipeline-${{ github.sha }}

jobs:
72 changes: 37 additions & 35 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,70 +1,72 @@
module github.com/pushbits/server

go 1.21
go 1.23

require (
github.com/alexedwards/argon2id v1.0.0
github.com/gin-contrib/location v0.0.2
github.com/gin-gonic/gin v1.9.1
github.com/gomarkdown/markdown v0.0.0-20231115200524-a660076da3fd
github.com/gin-contrib/location v1.0.1
github.com/gin-gonic/gin v1.10.0
github.com/gomarkdown/markdown v0.0.0-20240930133441-72d49d9543d8
github.com/jinzhu/configor v1.2.2
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
gopkg.in/yaml.v2 v2.4.0
gorm.io/driver/mysql v1.5.2
gorm.io/driver/postgres v1.5.4
gorm.io/driver/sqlite v1.5.4
gorm.io/gorm v1.25.5
gorm.io/driver/mysql v1.5.7
gorm.io/driver/postgres v1.5.9
gorm.io/driver/sqlite v1.5.6
gorm.io/gorm v1.25.12
maunium.net/go/mautrix v0.16.2
)

require (
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/bytedance/sonic v1.10.2 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/bytedance/sonic v1.12.3 // indirect
github.com/bytedance/sonic/loader v0.2.0 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gabriel-vasile/mimetype v1.4.6 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.16.0 // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/go-playground/validator/v10 v10.22.1 // indirect
github.com/go-sql-driver/mysql v1.8.1 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
github.com/jackc/pgx/v5 v5.5.1 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.7.1 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-sqlite3 v1.14.19 // indirect
github.com/mattn/go-sqlite3 v1.14.24 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/rs/zerolog v1.31.0 // indirect
github.com/tidwall/gjson v1.17.0 // indirect
github.com/rs/zerolog v1.33.0 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
go.mau.fi/util v0.2.1 // indirect
golang.org/x/arch v0.6.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20231219180239-dc181d75b848 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
go.mau.fi/util v0.8.1 // indirect
golang.org/x/arch v0.11.0 // indirect
golang.org/x/crypto v0.28.0 // indirect
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/text v0.19.0 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
maunium.net/go/maulogger/v2 v2.4.1 // indirect
)
176 changes: 76 additions & 100 deletions go.sum

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions internal/api/application_test.go
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@ func TestApi_RegisterApplicationWithoutUser(t *testing.T) {
reqWoUser := tests.Request{Name: "Invalid JSON Data", Method: "POST", Endpoint: "/application", Data: `{"name": "test1", "strict_compatibility": true}`, Headers: map[string]string{"Content-Type": "application/json"}}
_, c, err := reqWoUser.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

assert.Panicsf(func() { TestApplicationHandler.CreateApplication(c) }, "CreateApplication did not panic although user is not in context")
@@ -115,7 +115,7 @@ func TestApi_RegisterApplication(t *testing.T) {
var application model.Application
w, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

c.Set("user", user)
@@ -150,7 +150,7 @@ func TestApi_GetApplications(t *testing.T) {
for _, req := range testCases {
w, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

c.Set("user", user)
@@ -183,7 +183,7 @@ func TestApi_GetApplicationsWithoutUser(t *testing.T) {

_, c, err := testCase.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

assert.Panicsf(func() { TestApplicationHandler.GetApplications(c) }, "GetApplications did not panic although user is not in context")
@@ -203,7 +203,7 @@ func TestApi_GetApplicationErrors(t *testing.T) {
for id, req := range testCases {
w, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

c.Set("user", user)
@@ -229,7 +229,7 @@ func TestApi_GetApplication(t *testing.T) {

w, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

c.Set("user", user)
@@ -282,7 +282,7 @@ func TestApi_UpdateApplication(t *testing.T) {
for id, req := range testCases {
w, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

c.Set("user", user)
@@ -310,7 +310,7 @@ func TestApi_DeleteApplication(t *testing.T) {
for id, req := range testCases {
w, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

c.Set("user", user)
6 changes: 3 additions & 3 deletions internal/api/context_test.go
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ func TestApi_getID(t *testing.T) {
for id, req := range testCases {
w, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

c.Set("id", id)
@@ -74,7 +74,7 @@ func TestApi_getApplication(t *testing.T) {
for id, req := range testCases {
w, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

c.Set("id", id)
@@ -109,7 +109,7 @@ func TestApi_getUser(t *testing.T) {
for id, req := range testCases {
w, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

c.Set("id", id)
2 changes: 1 addition & 1 deletion internal/api/health_test.go
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ func TestApi_Health(t *testing.T) {
for _, req := range testCases {
w, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}
handler.Health(c)

4 changes: 2 additions & 2 deletions internal/api/notification_test.go
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ func TestApi_CreateNotification(t *testing.T) {
var notification model.Notification
w, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

c.Set("app", &testApplication)
@@ -83,7 +83,7 @@ func TestApi_DeleteNotification(t *testing.T) {
for id, req := range testCases {
w, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

c.Set("app", &testApplication)
6 changes: 3 additions & 3 deletions internal/api/user_test.go
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ func TestApi_CreateUser(t *testing.T) {
for _, req := range testCases {
w, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

TestUserHandler.CreateUser(c)
@@ -120,7 +120,7 @@ func TestApi_UpdateUser(t *testing.T) {
for id, req := range testCases {
w, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

c.Set("id", id)
@@ -134,7 +134,7 @@ func TestApi_UpdateUser(t *testing.T) {
for id, req := range testCases {
_, c, err := req.GetRequest()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

c.Set("id", id)
2 changes: 1 addition & 1 deletion internal/authentication/authentication.go
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ func (a *Authenticator) requireUserProperty(has hasUserProperty) gin.HandlerFunc

// RequireUser returns a Gin middleware which requires valid user credentials to be supplied with the request.
func (a *Authenticator) RequireUser() gin.HandlerFunc {
return a.requireUserProperty(func(user *model.User) bool {
return a.requireUserProperty(func(_ *model.User) bool {
return true
})
}
4 changes: 2 additions & 2 deletions internal/authentication/token.go
Original file line number Diff line number Diff line change
@@ -13,9 +13,9 @@ var (
)

func randIntn(n int) int {
max := big.NewInt(int64(n))
maxValue := big.NewInt(int64(n))

res, err := rand.Int(rand.Reader, max)
res, err := rand.Int(rand.Reader, maxValue)
if err != nil {
panic("random source is not available")
}
1 change: 0 additions & 1 deletion internal/dispatcher/notification.go
Original file line number Diff line number Diff line change
@@ -103,7 +103,6 @@ func (d *Dispatcher) DeleteNotification(a *model.Application, n *model.DeleteNot
newFormattedBody := fmt.Sprintf("<del>%s</del><br>- deleted", oldFormattedBody)

_, err = d.replaceMessage(a, newBody, newFormattedBody, deleteMessage.ID.String(), oldBody, oldFormattedBody)

if err != nil {
return err
}
6 changes: 3 additions & 3 deletions tests/mockups/helper.go
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@ import (
"encoding/base64"
)

func randStr(len int) string {
buff := make([]byte, len)
func randStr(length int) string {
buff := make([]byte, length)

_, err := rand.Read(buff)
if err != nil {
@@ -16,5 +16,5 @@ func randStr(len int) string {
str := base64.StdEncoding.EncodeToString(buff)

// Base 64 can be longer than len
return str[:len]
return str[:length]
}

0 comments on commit 15ea293

Please sign in to comment.