fix issue of default migrate version (#1536)

* fix issue of default migrate version

* chore: update console colors
This commit is contained in:
Kevin Wan
2022-02-14 23:09:32 +08:00
committed by GitHub
parent 6ab051568c
commit 6deb80625d
5 changed files with 27 additions and 19 deletions

View File

@@ -22,7 +22,7 @@ import (
"github.com/zeromicro/go-zero/tools/goctl/vars"
)
const zeromicroVersion = "1.3.0"
const zeromicroVersion = "v1.3.0"
const (
confirmUnknown = iota
@@ -57,8 +57,10 @@ func Migrate(c *cli.Context) error {
}
if verbose {
console.Success("[OK] refactor finish, execute %q on project root to check status.", "go test -race ./...")
console.Success("[OK] refactor finish, execute %q on project root to check status.",
"go test -race ./...")
}
return nil
}

View File

@@ -12,10 +12,12 @@ import (
"github.com/zeromicro/go-zero/tools/goctl/util/ctx"
)
const deprecatedGoZeroMod = "github.com/tal-tech/go-zero"
const deprecatedBuilderx = "github.com/tal-tech/go-zero/tools/goctl/model/sql/builderx"
const replacementBuilderx = "github.com/zeromicro/go-zero/core/stores/builder"
const goZeroMod = "github.com/zeromicro/go-zero"
const (
deprecatedGoZeroMod = "github.com/tal-tech/go-zero"
deprecatedBuilderx = "github.com/tal-tech/go-zero/tools/goctl/model/sql/builderx"
replacementBuilderx = "github.com/zeromicro/go-zero/core/stores/builder"
goZeroMod = "github.com/zeromicro/go-zero"
)
var errInvalidGoMod = errors.New("it's only working for go module")
@@ -38,11 +40,13 @@ func editMod(version string, verbose bool) error {
if !stringx.Contains(latest, version) {
return fmt.Errorf("release version %q is not found", version)
}
mod := fmt.Sprintf("%s@%s", goZeroMod, version)
err = removeRequire(deprecatedGoZeroMod, verbose)
if err != nil {
return err
}
return addRequire(mod, verbose)
}