瀏覽代碼

use fmt.Println instead of println

kevin 4 年之前
父節點
當前提交
89019a0b72

+ 2 - 1
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)

+ 1 - 2
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 {

+ 3 - 1
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
 }

+ 1 - 1
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 {