Update update.go

Fixed bug in skip version upgrade
This commit is contained in:
Toby Chui 2024-07-16 15:14:49 +08:00
parent 82f84470f7
commit 0828fd1958

View File

@ -9,7 +9,6 @@ package update
import ( import (
"fmt" "fmt"
"io/ioutil"
"os" "os"
"strconv" "strconv"
"strings" "strings"
@ -56,8 +55,8 @@ func RunConfigUpdate(fromVersion int, toVersion int) {
//Do iterate update //Do iterate update
for i := fromVersion; i < toVersion; i++ { for i := fromVersion; i < toVersion; i++ {
oldVersion := fromVersion oldVersion := i
newVersion := fromVersion + 1 newVersion := i + 1
fmt.Println("Updating from v", oldVersion, " to v", newVersion) fmt.Println("Updating from v", oldVersion, " to v", newVersion)
runUpdateRoutineWithVersion(oldVersion, newVersion) runUpdateRoutineWithVersion(oldVersion, newVersion)
//Write the updated version to file //Write the updated version to file
@ -92,7 +91,7 @@ func isFirstTimeInitialize(path string) (bool, error) {
} }
// Read the directory contents // Read the directory contents
files, err := ioutil.ReadDir(path) files, err := os.ReadDir(path)
if err != nil { if err != nil {
return false, err return false, err
} }