diff --git a/apis/serve.go b/apis/serve.go index 3cd71c12..8095a4ee 100644 --- a/apis/serve.go +++ b/apis/serve.go @@ -259,6 +259,7 @@ func Serve(app core.App, config ServeConfig) error { } if listener == nil { + //nolint:staticcheck return errors.New("The OnServe finalizer wasn't invoked. Did you forget to call the ServeEvent.Next() method?") } diff --git a/cmd/superuser.go b/cmd/superuser.go index 54c1b9b1..523fa532 100644 --- a/cmd/superuser.go +++ b/cmd/superuser.go @@ -36,16 +36,16 @@ func superuserUpsertCommand(app core.App) *cobra.Command { SilenceUsage: true, RunE: func(command *cobra.Command, args []string) error { if len(args) != 2 { - return errors.New("Missing email and password arguments.") + return errors.New("missing email and password arguments") } if args[0] == "" || is.EmailFormat.Validate(args[0]) != nil { - return errors.New("Missing or invalid email address.") + return errors.New("missing or invalid email address") } superusersCol, err := app.FindCachedCollectionByNameOrId(core.CollectionNameSuperusers) if err != nil { - return fmt.Errorf("Failed to fetch %q collection: %w.", core.CollectionNameSuperusers, err) + return fmt.Errorf("failed to fetch %q collection: %w", core.CollectionNameSuperusers, err) } superuser, err := app.FindAuthRecordByEmail(superusersCol, args[0]) @@ -57,7 +57,7 @@ func superuserUpsertCommand(app core.App) *cobra.Command { superuser.SetPassword(args[1]) if err := app.Save(superuser); err != nil { - return fmt.Errorf("Failed to upsert superuser account: %w.", err) + return fmt.Errorf("failed to upsert superuser account: %w", err) } color.Green("Successfully saved superuser %q!", superuser.Email()) @@ -76,16 +76,16 @@ func superuserCreateCommand(app core.App) *cobra.Command { SilenceUsage: true, RunE: func(command *cobra.Command, args []string) error { if len(args) != 2 { - return errors.New("Missing email and password arguments.") + return errors.New("missing email and password arguments") } if args[0] == "" || is.EmailFormat.Validate(args[0]) != nil { - return errors.New("Missing or invalid email address.") + return errors.New("missing or invalid email address") } superusersCol, err := app.FindCachedCollectionByNameOrId(core.CollectionNameSuperusers) if err != nil { - return fmt.Errorf("Failed to fetch %q collection: %w.", core.CollectionNameSuperusers, err) + return fmt.Errorf("failed to fetch %q collection: %w", core.CollectionNameSuperusers, err) } superuser := core.NewRecord(superusersCol) @@ -93,7 +93,7 @@ func superuserCreateCommand(app core.App) *cobra.Command { superuser.SetPassword(args[1]) if err := app.Save(superuser); err != nil { - return fmt.Errorf("Failed to create new superuser account: %w.", err) + return fmt.Errorf("failed to create new superuser account: %w", err) } color.Green("Successfully created new superuser %q!", superuser.Email()) @@ -112,22 +112,22 @@ func superuserUpdateCommand(app core.App) *cobra.Command { SilenceUsage: true, RunE: func(command *cobra.Command, args []string) error { if len(args) != 2 { - return errors.New("Missing email and password arguments.") + return errors.New("missing email and password arguments") } if args[0] == "" || is.EmailFormat.Validate(args[0]) != nil { - return errors.New("Missing or invalid email address.") + return errors.New("missing or invalid email address") } superuser, err := app.FindAuthRecordByEmail(core.CollectionNameSuperusers, args[0]) if err != nil { - return fmt.Errorf("Superuser with email %q doesn't exist.", args[0]) + return fmt.Errorf("superuser with email %q doesn't exist", args[0]) } superuser.SetPassword(args[1]) if err := app.Save(superuser); err != nil { - return fmt.Errorf("Failed to change superuser %q password: %w.", superuser.Email(), err) + return fmt.Errorf("failed to change superuser %q password: %w", superuser.Email(), err) } color.Green("Successfully changed superuser %q password!", superuser.Email()) @@ -146,17 +146,17 @@ func superuserDeleteCommand(app core.App) *cobra.Command { SilenceUsage: true, RunE: func(command *cobra.Command, args []string) error { if len(args) == 0 || args[0] == "" || is.EmailFormat.Validate(args[0]) != nil { - return errors.New("Invalid or missing email address.") + return errors.New("invalid or missing email address") } superuser, err := app.FindAuthRecordByEmail(core.CollectionNameSuperusers, args[0]) if err != nil { - color.Yellow("Superuser %q is missing or already deleted.", args[0]) + color.Yellow("superuser %q is missing or already deleted", args[0]) return nil } if err := app.Delete(superuser); err != nil { - return fmt.Errorf("Failed to delete superuser %q: %w.", superuser.Email(), err) + return fmt.Errorf("failed to delete superuser %q: %w", superuser.Email(), err) } color.Green("Successfully deleted superuser %q!", superuser.Email()) @@ -175,16 +175,16 @@ func superuserOTPCommand(app core.App) *cobra.Command { SilenceUsage: true, RunE: func(command *cobra.Command, args []string) error { if len(args) == 0 || args[0] == "" || is.EmailFormat.Validate(args[0]) != nil { - return errors.New("Invalid or missing email address.") + return errors.New("invalid or missing email address") } superuser, err := app.FindAuthRecordByEmail(core.CollectionNameSuperusers, args[0]) if err != nil { - return fmt.Errorf("Superuser with email %q doesn't exist.", args[0]) + return fmt.Errorf("superuser with email %q doesn't exist", args[0]) } if !superuser.Collection().OTP.Enabled { - return errors.New("OTP is not enabled for the _superusers collection.") + return errors.New("OTP auth is not enabled for the _superusers collection") } pass := security.RandomStringWithAlphabet(superuser.Collection().OTP.Length, "1234567890") @@ -196,7 +196,7 @@ func superuserOTPCommand(app core.App) *cobra.Command { err = app.Save(otp) if err != nil { - return fmt.Errorf("Failed to create OTP: %w", err) + return fmt.Errorf("failed to create OTP: %w", err) } color.New(color.BgGreen, color.FgBlack).Printf("Successfully created OTP for superuser %q:", superuser.Email()) diff --git a/core/collection_query.go b/core/collection_query.go index 5108dd3c..10825101 100644 --- a/core/collection_query.go +++ b/core/collection_query.go @@ -220,7 +220,7 @@ func (app *BaseApp) IsCollectionNameUnique(name string, excludeIds ...string) bo // cascade and file delete actions. func (app *BaseApp) TruncateCollection(collection *Collection) error { if collection.IsView() { - return errors.New("view collections cannot be truncated since they don't store their own records.") + return errors.New("view collections cannot be truncated since they don't store their own records") } return app.RunInTransaction(func(txApp App) error { diff --git a/core/migrations_runner.go b/core/migrations_runner.go index 3602678b..9b0ff76a 100644 --- a/core/migrations_runner.go +++ b/core/migrations_runner.go @@ -112,7 +112,7 @@ func (r *MigrationsRunner) Run(args ...string) error { color.Green("The %s table was synced with the available migrations.", r.tableName) return nil default: - return fmt.Errorf("Unsupported command: %q\n", cmd) + return fmt.Errorf("unsupported command: %q", cmd) } } @@ -151,12 +151,12 @@ func (r *MigrationsRunner) Up() ([]string, error) { // ignore empty Up action if m.Up != nil { if err := m.Up(txApp); err != nil { - return fmt.Errorf("Failed to apply migration %s: %w", m.File, err) + return fmt.Errorf("failed to apply migration %s: %w", m.File, err) } } if err := r.saveAppliedMigration(txApp, m.File); err != nil { - return fmt.Errorf("Failed to save applied migration info for %s: %w", m.File, err) + return fmt.Errorf("failed to save applied migration info for %s: %w", m.File, err) } applied = append(applied, m.File) @@ -204,12 +204,12 @@ func (r *MigrationsRunner) Down(toRevertCount int) ([]string, error) { // ignore empty Down action if m.Down != nil { if err := m.Down(txApp); err != nil { - return fmt.Errorf("Failed to revert migration %s: %w", m.File, err) + return fmt.Errorf("failed to revert migration %s: %w", m.File, err) } } if err := r.saveRevertedMigration(txApp, m.File); err != nil { - return fmt.Errorf("Failed to save reverted migration info for %s: %w", m.File, err) + return fmt.Errorf("failed to save reverted migration info for %s: %w", m.File, err) } reverted = append(reverted, m.File) diff --git a/go.mod b/go.mod index f043f499..429ead32 100644 --- a/go.mod +++ b/go.mod @@ -17,11 +17,11 @@ require ( github.com/pocketbase/tygoja v0.0.0-20250103200817-ca580d8c5119 github.com/spf13/cast v1.7.1 github.com/spf13/cobra v1.9.1 - golang.org/x/crypto v0.36.0 - golang.org/x/net v0.37.0 - golang.org/x/oauth2 v0.28.0 - golang.org/x/sync v0.12.0 - modernc.org/sqlite v1.36.3 + golang.org/x/crypto v0.37.0 + golang.org/x/net v0.39.0 + golang.org/x/oauth2 v0.29.0 + golang.org/x/sync v0.13.0 + modernc.org/sqlite v1.37.0 ) require ( @@ -38,13 +38,13 @@ require ( github.com/ncruces/go-strftime v0.1.9 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/spf13/pflag v1.0.6 // indirect - golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect - golang.org/x/image v0.25.0 // indirect + golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect + golang.org/x/image v0.26.0 // indirect golang.org/x/mod v0.24.0 // indirect - golang.org/x/sys v0.31.0 // indirect - golang.org/x/text v0.23.0 // indirect - golang.org/x/tools v0.31.0 // indirect - modernc.org/libc v1.61.13 // indirect + golang.org/x/sys v0.32.0 // indirect + golang.org/x/text v0.24.0 // indirect + golang.org/x/tools v0.32.0 // indirect + modernc.org/libc v1.62.1 // indirect modernc.org/mathutil v1.7.1 // indirect - modernc.org/memory v1.8.2 // indirect + modernc.org/memory v1.9.1 // indirect ) diff --git a/go.sum b/go.sum index 1eaa31f4..f834dd29 100644 --- a/go.sum +++ b/go.sum @@ -78,33 +78,33 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= -golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw= -golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM= +golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE= +golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc= +golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 h1:R84qjqJb5nVJMxqWYb3np9L5ZsaDtB+a39EqjV0JSUM= +golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0/go.mod h1:S9Xr4PYopiDyqSyp5NjCrhFrqg6A5zA2E/iPHPhqnS8= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ= -golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs= +golang.org/x/image v0.26.0 h1:4XjIFEZWQmCZi6Wv8BoxsDhRU3RVnLX04dToTDAEPlY= +golang.org/x/image v0.26.0/go.mod h1:lcxbMFAovzpnJxzXS3nyL83K27tmqtKzIJpctK8YO5c= golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= -golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/oauth2 v0.28.0 h1:CrgCKl8PPAVtLnU3c+EDw6x11699EWlsDeWNWKdIOkc= -golang.org/x/oauth2 v0.28.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= -golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= -golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= +golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= +golang.org/x/oauth2 v0.29.0 h1:WdYw2tdTK1S8olAzWHdgeqfy+Mtm9XNhv/xJsY65d98= +golang.org/x/oauth2 v0.29.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= +golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= +golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= +golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= -golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= +golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU= -golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= +golang.org/x/tools v0.32.0 h1:Q7N1vhpkQv7ybVzLFtTjvQya2ewbwNDZzUgfXGqtMWU= +golang.org/x/tools v0.32.0/go.mod h1:ZxrU41P/wAbZD8EDa6dDCa6XfpkhJ7HFMjHJXfBDu8s= google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -112,26 +112,26 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -modernc.org/cc/v4 v4.24.4 h1:TFkx1s6dCkQpd6dKurBNmpo+G8Zl4Sq/ztJ+2+DEsh0= -modernc.org/cc/v4 v4.24.4/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0= -modernc.org/ccgo/v4 v4.23.16 h1:Z2N+kk38b7SfySC1ZkpGLN2vthNJP1+ZzGZIlH7uBxo= -modernc.org/ccgo/v4 v4.23.16/go.mod h1:nNma8goMTY7aQZQNTyN9AIoJfxav4nvTnvKThAeMDdo= +modernc.org/cc/v4 v4.25.2 h1:T2oH7sZdGvTaie0BRNFbIYsabzCxUQg8nLqCdQ2i0ic= +modernc.org/cc/v4 v4.25.2/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0= +modernc.org/ccgo/v4 v4.25.1 h1:TFSzPrAGmDsdnhT9X2UrcPMI3N/mJ9/X9ykKXwLhDsU= +modernc.org/ccgo/v4 v4.25.1/go.mod h1:njjuAYiPflywOOrm3B7kCB444ONP5pAVr8PIEoE0uDw= modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE= modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ= -modernc.org/gc/v2 v2.6.3 h1:aJVhcqAte49LF+mGveZ5KPlsp4tdGdAOT4sipJXADjw= -modernc.org/gc/v2 v2.6.3/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito= -modernc.org/libc v1.61.13 h1:3LRd6ZO1ezsFiX1y+bHd1ipyEHIJKvuprv0sLTBwLW8= -modernc.org/libc v1.61.13/go.mod h1:8F/uJWL/3nNil0Lgt1Dpz+GgkApWh04N3el3hxJcA6E= +modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI= +modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito= +modernc.org/libc v1.62.1 h1:s0+fv5E3FymN8eJVmnk0llBe6rOxCu/DEU+XygRbS8s= +modernc.org/libc v1.62.1/go.mod h1:iXhATfJQLjG3NWy56a6WVU73lWOcdYVxsvwCgoPljuo= modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= -modernc.org/memory v1.8.2 h1:cL9L4bcoAObu4NkxOlKWBWtNHIsnnACGF/TbqQ6sbcI= -modernc.org/memory v1.8.2/go.mod h1:ZbjSvMO5NQ1A2i3bWeDiVMxIorXwdClKE/0SZ+BMotU= +modernc.org/memory v1.9.1 h1:V/Z1solwAVmMW1yttq3nDdZPJqV1rM05Ccq6KMSZ34g= +modernc.org/memory v1.9.1/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw= modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8= modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns= modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w= modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE= -modernc.org/sqlite v1.36.3 h1:qYMYlFR+rtLDUzuXoST1SDIdEPbX8xzuhdF90WsX1ss= -modernc.org/sqlite v1.36.3/go.mod h1:ADySlx7K4FdY5MaJcEv86hTJ0PjedAloTUuif0YS3ws= +modernc.org/sqlite v1.37.0 h1:s1TMe7T3Q3ovQiK2Ouz4Jwh7dw4ZDqbebSDTlSJdfjI= +modernc.org/sqlite v1.37.0/go.mod h1:5YiWv+YviqGMuGw4V+PNplcyaJ5v+vQd7TQOgkACoJM= modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0= modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= diff --git a/golangci.yml b/golangci.yml index 9b8db42e..47bd8b65 100644 --- a/golangci.yml +++ b/golangci.yml @@ -1,28 +1,27 @@ +version: "2" run: go: 1.23 concurrency: 4 timeout: 10m - linters: - disable-all: true + default: none enable: - asasalint - asciicheck - - gofmt - - goimports - gomodguard - goprintffuncname - - gosimple - govet - ineffassign - misspell - nakedret - nolintlint - prealloc - - prealloc - reassign - staticcheck - - typecheck - unconvert - unused - whitespace +formatters: + enable: + - gofmt + - goimports diff --git a/modernc_versions_check.go b/modernc_versions_check.go index 33277ddf..a855a2ef 100644 --- a/modernc_versions_check.go +++ b/modernc_versions_check.go @@ -10,8 +10,8 @@ import ( ) const ( - expectedDriverVersion = "v1.36.3" - expectedLibcVersion = "v1.61.13" + expectedDriverVersion = "v1.37.0" + expectedLibcVersion = "v1.62.1" // ModerncDepsCheckHookId is the id of the hook that performs the modernc.org/* deps checks. // It could be used for removing/unbinding the hook if you don't want the checks. diff --git a/plugins/ghupdate/ghupdate.go b/plugins/ghupdate/ghupdate.go index d9547278..0ffabe69 100644 --- a/plugins/ghupdate/ghupdate.go +++ b/plugins/ghupdate/ghupdate.go @@ -204,13 +204,13 @@ func (p *plugin) update(withBackup bool) error { // try again with an .exe extension newExec = newExec + ".exe" if _, fallbackErr := os.Stat(newExec); fallbackErr != nil { - return fmt.Errorf("The executable in the extracted path is missing or it is inaccessible: %v, %v", err, fallbackErr) + return fmt.Errorf("the executable in the extracted path is missing or it is inaccessible: %v, %v", err, fallbackErr) } } // rename the current executable if err := os.Rename(oldExec, renamedOldExec); err != nil { - return fmt.Errorf("Failed to rename the current executable: %w", err) + return fmt.Errorf("failed to rename the current executable: %w", err) } tryToRevertExecChanges := func() { @@ -227,7 +227,7 @@ func (p *plugin) update(withBackup bool) error { // replace with the extracted binary if err := os.Rename(newExec, oldExec); err != nil { tryToRevertExecChanges() - return fmt.Errorf("Failed replacing the executable: %w", err) + return fmt.Errorf("failed replacing the executable: %w", err) } if withBackup { diff --git a/plugins/jsvm/jsvm.go b/plugins/jsvm/jsvm.go index dcaa066a..d98f0f1a 100644 --- a/plugins/jsvm/jsvm.go +++ b/plugins/jsvm/jsvm.go @@ -314,7 +314,7 @@ func (p *plugin) registerHooks() error { func() { defer func() { if err := recover(); err != nil { - fmtErr := fmt.Errorf("Failed to execute %s:\n - %v", file, err) + fmtErr := fmt.Errorf("failed to execute %s:\n - %v", file, err) if p.config.HooksWatch { color.Red("%v", fmtErr) diff --git a/plugins/migratecmd/migratecmd.go b/plugins/migratecmd/migratecmd.go index 253f45cc..38485ff1 100644 --- a/plugins/migratecmd/migratecmd.go +++ b/plugins/migratecmd/migratecmd.go @@ -145,7 +145,7 @@ func (p *plugin) createCommand() *cobra.Command { func (p *plugin) migrateCreateHandler(template string, args []string, interactive bool) (string, error) { if len(args) < 1 { - return "", errors.New("Missing migration file name") + return "", errors.New("missing migration file name") } name := args[0] @@ -172,7 +172,7 @@ func (p *plugin) migrateCreateHandler(template string, args []string, interactiv template, templateErr = p.goBlankTemplate() } if templateErr != nil { - return "", fmt.Errorf("Failed to resolve create template: %v\n", templateErr) + return "", fmt.Errorf("failed to resolve create template: %v", templateErr) } } @@ -183,7 +183,7 @@ func (p *plugin) migrateCreateHandler(template string, args []string, interactiv // save the migration file if err := os.WriteFile(resultFilePath, []byte(template), 0644); err != nil { - return "", fmt.Errorf("Failed to save migration file %q: %v\n", resultFilePath, err) + return "", fmt.Errorf("failed to save migration file %q: %v", resultFilePath, err) } if interactive { @@ -199,7 +199,7 @@ func (p *plugin) migrateCollectionsHandler(args []string, interactive bool) (str collections := []*core.Collection{} if err := p.app.CollectionQuery().OrderBy("created ASC").All(&collections); err != nil { - return "", fmt.Errorf("Failed to fetch migrations list: %v\n", err) + return "", fmt.Errorf("failed to fetch migrations list: %v", err) } var template string @@ -210,7 +210,7 @@ func (p *plugin) migrateCollectionsHandler(args []string, interactive bool) (str template, templateErr = p.goSnapshotTemplate(collections) } if templateErr != nil { - return "", fmt.Errorf("Failed to resolve template: %v\n", templateErr) + return "", fmt.Errorf("failed to resolve template: %v", templateErr) } return p.migrateCreateHandler(template, createArgs, interactive) diff --git a/tools/auth/twitch.go b/tools/auth/twitch.go index 3c9fd84a..17db99e4 100644 --- a/tools/auth/twitch.go +++ b/tools/auth/twitch.go @@ -66,7 +66,7 @@ func (p *Twitch) FetchAuthUser(token *oauth2.Token) (*AuthUser, error) { } if len(extracted.Data) == 0 { - return nil, errors.New("Failed to fetch AuthUser data") + return nil, errors.New("failed to fetch AuthUser data") } user := &AuthUser{ diff --git a/tools/filesystem/internal/fileblob/fileblob.go b/tools/filesystem/internal/fileblob/fileblob.go index e057db5d..0daa3a8f 100644 --- a/tools/filesystem/internal/fileblob/fileblob.go +++ b/tools/filesystem/internal/fileblob/fileblob.go @@ -653,7 +653,7 @@ func (w *writer) Close() error { // Always delete the temp file. On success, it will have been renamed so // the Remove will fail. - tempname := w.File.Name() + tempname := w.Name() defer os.Remove(tempname) // Check if the write was cancelled. diff --git a/tools/mailer/sendmail.go b/tools/mailer/sendmail.go index b9e9c4ea..b1dbaec4 100644 --- a/tools/mailer/sendmail.go +++ b/tools/mailer/sendmail.go @@ -95,5 +95,5 @@ func findSendmailPath() (string, error) { } } - return "", errors.New("Failed to locate a sendmail executable path.") + return "", errors.New("failed to locate a sendmail executable path") } diff --git a/tools/search/simple_field_resolver.go b/tools/search/simple_field_resolver.go index 09a1a651..bfd96ada 100644 --- a/tools/search/simple_field_resolver.go +++ b/tools/search/simple_field_resolver.go @@ -76,7 +76,7 @@ func (r *SimpleFieldResolver) UpdateQuery(query *dbx.SelectQuery) error { // Returns error if `field` is not in `r.allowedFields`. func (r *SimpleFieldResolver) Resolve(field string) (*ResolverResult, error) { if !list.ExistInSliceWithRegex(field, r.allowedFields) { - return nil, fmt.Errorf("Failed to resolve field %q.", field) + return nil, fmt.Errorf("failed to resolve field %q", field) } parts := strings.Split(field, ".") diff --git a/tools/tokenizer/tokenizer.go b/tools/tokenizer/tokenizer.go index 6fdfb836..934d3693 100644 --- a/tools/tokenizer/tokenizer.go +++ b/tools/tokenizer/tokenizer.go @@ -142,9 +142,10 @@ func (t *Tokenizer) readToken() (string, error) { } else if !t.ignoreParenthesis && ch == ')' && parenthesis > 0 && quoteCh == eof { parenthesis-- // closing parenthesis } else if t.isQuoteRune(ch) { - if quoteCh == ch { + switch quoteCh { + case ch: quoteCh = eof // closing quote - } else if quoteCh == eof { + case eof: quoteCh = ch // opening quote } } diff --git a/tools/types/json_array.go b/tools/types/json_array.go index 4c01d3a2..024fd7b0 100644 --- a/tools/types/json_array.go +++ b/tools/types/json_array.go @@ -47,7 +47,7 @@ func (m *JSONArray[T]) Scan(value any) error { case string: data = []byte(v) default: - return fmt.Errorf("Failed to unmarshal JSONArray value: %q.", value) + return fmt.Errorf("failed to unmarshal JSONArray value: %q", value) } if len(data) == 0 { diff --git a/ui/package-lock.json b/ui/package-lock.json index 9439027b..d7b4f256 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -233,13 +233,6 @@ "node": ">=12" } }, - "node_modules/@googlemaps/js-api-loader": { - "version": "1.16.8", - "resolved": "https://registry.npmjs.org/@googlemaps/js-api-loader/-/js-api-loader-1.16.8.tgz", - "integrity": "sha512-CROqqwfKotdO6EBjZO/gQGVTbeDps5V7Mt9+8+5Q+jTg5CRMi3Ii/L9PmV3USROrt2uWxtGzJHORmByxyo9pSQ==", - "dev": true, - "optional": true - }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.8", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", @@ -871,16 +864,6 @@ "integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==", "dev": true }, - "node_modules/leaflet-geosearch": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/leaflet-geosearch/-/leaflet-geosearch-4.2.0.tgz", - "integrity": "sha512-UWNhFSaUcLlAP5UQY75ziWCl3cp0UCcmcFczPHLHjuAVPOHoPTe0nSgHJuI3pSTJBQm46NYoZOlgonrWceUznQ==", - "dev": true, - "optionalDependencies": { - "@googlemaps/js-api-loader": "^1.16.6", - "leaflet": "^1.6.0" - } - }, "node_modules/locate-character": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz",