Skip to content

Commit

Permalink
make lint happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
bugtower100 committed Dec 30, 2024
1 parent bc249e5 commit bfe89d1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
11 changes: 6 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func main() {
log.Warn("检测到 auto_update.exe,即将自动退出当前程序并进行升级")
log.Warn("程序目录下会出现“升级日志.log”,这代表升级正在进行中,如果失败了请检查此文件。")

err := CheckUpdater(diceManager)
err = CheckUpdater(diceManager)
if err != nil {
log.Error("升级程序检查失败: ", err.Error())
} else {
Expand All @@ -353,7 +353,7 @@ func main() {
}

if doNext {
err := CheckUpdater(diceManager)
err = CheckUpdater(diceManager)
if err != nil {
log.Error("升级程序检查失败: ", err.Error())
} else {
Expand All @@ -368,7 +368,7 @@ func main() {
removeUpdateFiles()

if opts.UpdateTest {
err := CheckUpdater(diceManager)
err = CheckUpdater(diceManager)
if err != nil {
log.Error("升级程序检查失败: ", err.Error())
} else {
Expand All @@ -378,7 +378,7 @@ func main() {

// 先临时放这里,后面再整理一下升级模块
diceManager.UpdateSealdiceByFile = func(packName string, log *log.Helper) bool {
err := CheckUpdater(diceManager)
err = CheckUpdater(diceManager)
if err != nil {
log.Error("升级程序检查失败: ", err.Error())
return false
Expand All @@ -399,7 +399,8 @@ func main() {

useBuiltinUI := false
checkFrontendExists := func() bool {
stat, err := os.Stat("./frontend_overwrite")
var stat os.FileInfo
stat, err = os.Stat("./frontend_overwrite")
return err == nil && stat.IsDir()
}
if !checkFrontendExists() {
Expand Down
14 changes: 11 additions & 3 deletions migrate/v150_attrs.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,18 @@ func V150Upgrade() error {
}
defer func() {
if p := recover(); p != nil {
tx.Rollback()
err = tx.Rollback()
if err != nil {
log.Errorf("回滚事务时出错: %v", err)
}
panic(p) // 继续传播 panic
} else if err != nil {
tx.Rollback()
log.Errorf("日志处理时出现异常行为: %v", err)
err = tx.Rollback()
if err != nil {
log.Errorf("回滚事务时出错: %v", err)
return
}
} else {
err = tx.Commit()
if err != nil {
Expand Down Expand Up @@ -464,7 +472,7 @@ func V150Upgrade() error {
sheetIdBindByGroupUserId = map[string]string{}

for _, singleSql := range v150sqls {
if _, err := tx.Exec(singleSql); err != nil {
if _, err = tx.Exec(singleSql); err != nil {
return fmt.Errorf("执行 SQL 出错: %w", err)
}
}
Expand Down

0 comments on commit bfe89d1

Please sign in to comment.