Skip to content

Commit

Permalink
server: fix errors.Is argument order
Browse files Browse the repository at this point in the history
  • Loading branch information
odrling committed Nov 21, 2024
1 parent 9bf49ed commit 00c4122
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions server/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func initOlderKarasExports(ctx context.Context) error {
var karas []KaraInfoDB
db := GetDB(ctx)
err := db.Scopes(CurrentKaras).Find(&karas).Error
if errors.Is(gorm.ErrRecordNotFound, err) {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil
}
if err != nil {
Expand All @@ -197,7 +197,7 @@ func initOlderKarasExports(ctx context.Context) error {
for _, kara := range karas {
mugen_export := MugenExport{KaraID: kara.ID, GitlabIssue: -1}
err := db.Create(&mugen_export).Error
if errors.Is(gorm.ErrDuplicatedKey, err) {
if errors.Is(err, gorm.ErrDuplicatedKey) {
// ignore karas that are already exported
continue
}
Expand Down
2 changes: 1 addition & 1 deletion server/mugen.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ func MugenExportKara(ctx context.Context, input *MugenExportInput) (*MugenExport
func exportRemainingKaras(ctx context.Context, db *gorm.DB) error {
var remaining_karas []KaraInfoDB
err := db.Where("id NOT IN (?)", db.Table("mugen_exports").Select("kara_id AS id")).Find(&remaining_karas).Error
if errors.Is(gorm.ErrRecordNotFound, err) {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil
}
if err != nil {
Expand Down

0 comments on commit 00c4122

Please sign in to comment.