chore: update warning message (#1487)

master tools/goctl/v1.3.0-beta1
Kevin Wan 3 years ago committed by GitHub
parent 696fda1db4
commit 0e0abc3a95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -62,7 +62,7 @@ func rewriteImport(verbose bool) error {
time.Sleep(200 * time.Millisecond)
}
var doneChan = syncx.NewDoneChan()
doneChan := syncx.NewDoneChan()
defer func() {
doneChan.Close()
}()
@ -168,7 +168,7 @@ func rewriteFile(pkgs map[string]*ast.Package, verbose bool) error {
func writeFile(pkgs []*ast.Package, verbose bool) error {
for _, pkg := range pkgs {
for filename, file := range pkg.Files {
var w = bytes.NewBuffer(nil)
w := bytes.NewBuffer(nil)
err := format.Node(w, fset, file)
if err != nil {
return fmt.Errorf("[rewriteImport] format file %s error: %+v", filename, err)
@ -249,21 +249,25 @@ It's recommended to use the replacement package, do you want to replace?
msg = aurora.Yellow(msg).String()
}
fmt.Print(msg)
var in string
for {
var in string
fmt.Scanln(&in)
if len(in) == 0 {
console.Warning("nothing input, please try again [input 'Y' for yes, 'N' for no]:")
continue
}
if strings.EqualFold(in, "Y") {
fn(true)
return
} else if strings.EqualFold(in, "N") {
}
if strings.EqualFold(in, "N") {
fn(false)
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…
Cancel
Save