From 89019a0b721e51e529928f95bd93eeaaeaf2eb0c Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 11 Aug 2020 12:44:21 +0800 Subject: [PATCH] use fmt.Println instead of println --- example/periodicalexecutor/pe.go | 3 ++- tools/goctl/api/gogen/util.go | 3 +-- tools/goctl/api/javagen/genpacket.go | 4 +++- tools/goctl/api/tsgen/genpacket.go | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/example/periodicalexecutor/pe.go b/example/periodicalexecutor/pe.go index 3be333c8..fbaa5a94 100644 --- a/example/periodicalexecutor/pe.go +++ b/example/periodicalexecutor/pe.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "time" "github.com/tal-tech/go-zero/core/executors" @@ -8,7 +9,7 @@ import ( func main() { exeutor := executors.NewBulkExecutor(func(items []interface{}) { - println(len(items)) + fmt.Println(len(items)) }, executors.WithBulkTasks(10)) for { exeutor.Add(1) diff --git a/tools/goctl/api/gogen/util.go b/tools/goctl/api/gogen/util.go index b89b787b..44d8a6fd 100644 --- a/tools/goctl/api/gogen/util.go +++ b/tools/goctl/api/gogen/util.go @@ -44,8 +44,7 @@ func getParentPackage(dir string) (string, error) { parent := path.Join(gopath, "src") pos := strings.Index(absDir, parent) if pos < 0 { - message := fmt.Sprintf("%s not in gomod project path, or not in GOPATH of %s directory", absDir, gopath) - println(message) + fmt.Printf("%s not in gomod project path, or not in GOPATH of %s directory\n", absDir, gopath) tempPath = filepath.Dir(absDir) rootPath = absDir[len(tempPath)+1:] } else { diff --git a/tools/goctl/api/javagen/genpacket.go b/tools/goctl/api/javagen/genpacket.go index 83497bc2..721eeddc 100644 --- a/tools/goctl/api/javagen/genpacket.go +++ b/tools/goctl/api/javagen/genpacket.go @@ -175,7 +175,7 @@ func formatFile(tmplBytes *bytes.Buffer, file *os.File) { builder.WriteString(scanner.Text() + "\n") } 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 } } + writeBreakline(writer) writeIndent(writer, 1) genGetSet(writer, tp, 2) writeIndent(writer, 1) fmt.Fprintln(writer, "}") + return nil } diff --git a/tools/goctl/api/tsgen/genpacket.go b/tools/goctl/api/tsgen/genpacket.go index 2f7e9cd8..159c8c6a 100644 --- a/tools/goctl/api/tsgen/genpacket.go +++ b/tools/goctl/api/tsgen/genpacket.go @@ -156,7 +156,7 @@ func paramsForRoute(route spec.Route, prefixForType func(string) string) string hasBody := hasRequestBody(route) rt, err := goTypeToTs(route.RequestType.Name, prefixForType) if err != nil { - println(err.Error()) + fmt.Println(err.Error()) return "" } if hasParams && hasBody {