use fmt.Println instead of println

This commit is contained in:
kevin
2020-08-11 12:44:21 +08:00
committed by kingxt
parent f77c73eec1
commit 4f59fd306a
4 changed files with 7 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package main package main
import ( import (
"fmt"
"time" "time"
"github.com/tal-tech/go-zero/core/executors" "github.com/tal-tech/go-zero/core/executors"
@@ -8,7 +9,7 @@ import (
func main() { func main() {
exeutor := executors.NewBulkExecutor(func(items []interface{}) { exeutor := executors.NewBulkExecutor(func(items []interface{}) {
println(len(items)) fmt.Println(len(items))
}, executors.WithBulkTasks(10)) }, executors.WithBulkTasks(10))
for { for {
exeutor.Add(1) exeutor.Add(1)

View File

@@ -44,8 +44,7 @@ func getParentPackage(dir string) (string, error) {
parent := path.Join(gopath, "src") parent := path.Join(gopath, "src")
pos := strings.Index(absDir, parent) pos := strings.Index(absDir, parent)
if pos < 0 { if pos < 0 {
message := fmt.Sprintf("%s not in gomod project path, or not in GOPATH of %s directory", absDir, gopath) fmt.Printf("%s not in gomod project path, or not in GOPATH of %s directory\n", absDir, gopath)
println(message)
tempPath = filepath.Dir(absDir) tempPath = filepath.Dir(absDir)
rootPath = absDir[len(tempPath)+1:] rootPath = absDir[len(tempPath)+1:]
} else { } else {

View File

@@ -175,7 +175,7 @@ func formatFile(tmplBytes *bytes.Buffer, file *os.File) {
builder.WriteString(scanner.Text() + "\n") builder.WriteString(scanner.Text() + "\n")
} }
if err := scanner.Err(); err != nil { if err := scanner.Err(); err != nil {
println(err) fmt.Println(err)
} }
} }
@@ -268,10 +268,12 @@ func genType(writer io.Writer, tp spec.Type) error {
return err return err
} }
} }
writeBreakline(writer) writeBreakline(writer)
writeIndent(writer, 1) writeIndent(writer, 1)
genGetSet(writer, tp, 2) genGetSet(writer, tp, 2)
writeIndent(writer, 1) writeIndent(writer, 1)
fmt.Fprintln(writer, "}") fmt.Fprintln(writer, "}")
return nil return nil
} }

View File

@@ -156,7 +156,7 @@ func paramsForRoute(route spec.Route, prefixForType func(string) string) string
hasBody := hasRequestBody(route) hasBody := hasRequestBody(route)
rt, err := goTypeToTs(route.RequestType.Name, prefixForType) rt, err := goTypeToTs(route.RequestType.Name, prefixForType)
if err != nil { if err != nil {
println(err.Error()) fmt.Println(err.Error())
return "" return ""
} }
if hasParams && hasBody { if hasParams && hasBody {