mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-23 09:00:20 +08:00
chore: update warning message (#1487)
This commit is contained in:
parent
696fda1db4
commit
0e0abc3a95
@ -62,7 +62,7 @@ func rewriteImport(verbose bool) error {
|
|||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
var doneChan = syncx.NewDoneChan()
|
doneChan := syncx.NewDoneChan()
|
||||||
defer func() {
|
defer func() {
|
||||||
doneChan.Close()
|
doneChan.Close()
|
||||||
}()
|
}()
|
||||||
@ -168,7 +168,7 @@ func rewriteFile(pkgs map[string]*ast.Package, verbose bool) error {
|
|||||||
func writeFile(pkgs []*ast.Package, verbose bool) error {
|
func writeFile(pkgs []*ast.Package, verbose bool) error {
|
||||||
for _, pkg := range pkgs {
|
for _, pkg := range pkgs {
|
||||||
for filename, file := range pkg.Files {
|
for filename, file := range pkg.Files {
|
||||||
var w = bytes.NewBuffer(nil)
|
w := bytes.NewBuffer(nil)
|
||||||
err := format.Node(w, fset, file)
|
err := format.Node(w, fset, file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("[rewriteImport] format file %s error: %+v", filename, err)
|
return fmt.Errorf("[rewriteImport] format file %s error: %+v", filename, err)
|
||||||
@ -243,27 +243,31 @@ func refactorBuilderx(deprecated, replacement string, fn func(allow bool)) {
|
|||||||
Deprecated package: %q
|
Deprecated package: %q
|
||||||
Replacement package: %q
|
Replacement package: %q
|
||||||
It's recommended to use the replacement package, do you want to replace?
|
It's recommended to use the replacement package, do you want to replace?
|
||||||
[input 'Y' for yes, 'N' for no]:`, deprecated, replacement)
|
[input 'Y' for yes, 'N' for no]: `, deprecated, replacement)
|
||||||
|
|
||||||
if runtime.GOOS != vars.OsWindows {
|
if runtime.GOOS != vars.OsWindows {
|
||||||
msg = aurora.Yellow(msg).String()
|
msg = aurora.Yellow(msg).String()
|
||||||
}
|
}
|
||||||
fmt.Print(msg)
|
fmt.Print(msg)
|
||||||
var in string
|
|
||||||
for {
|
for {
|
||||||
|
var in string
|
||||||
fmt.Scanln(&in)
|
fmt.Scanln(&in)
|
||||||
if len(in) == 0 {
|
if len(in) == 0 {
|
||||||
console.Warning("nothing input, please try again [input 'Y' for yes, 'N' for no]:")
|
console.Warning("nothing input, please try again [input 'Y' for yes, 'N' for no]:")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.EqualFold(in, "Y") {
|
if strings.EqualFold(in, "Y") {
|
||||||
fn(true)
|
fn(true)
|
||||||
return
|
return
|
||||||
} else if strings.EqualFold(in, "N") {
|
}
|
||||||
|
|
||||||
|
if strings.EqualFold(in, "N") {
|
||||||
fn(false)
|
fn(false)
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
console.Warning("invalid input, please try again [input 'Y' for yes, 'N' for no]:")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.Warning("invalid input, please try again [input 'Y' for yes, 'N' for no]:")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user