瀏覽代碼

Fix the problem of package name for generated kt code. (#3082)

Co-authored-by: 李春华 <lichunhua@threesoft.cn>
lchjczw 2 年之前
父節點
當前提交
189e9bd9da
共有 2 個文件被更改,包括 6 次插入2 次删除
  1. 1 1
      tools/goctl/api/ktgen/api.tpl
  2. 5 1
      tools/goctl/api/ktgen/gen.go

+ 1 - 1
tools/goctl/api/ktgen/api.tpl

@@ -1,4 +1,4 @@
-package {{with .Info}}{{.Desc}}{{end}}
+package {{.Pkg}}
 
 import com.google.gson.Gson
 

+ 5 - 1
tools/goctl/api/ktgen/gen.go

@@ -82,5 +82,9 @@ func genApi(dir, pkg string, api *spec.ApiSpec) error {
 	if e != nil {
 		return e
 	}
-	return t.Execute(file, api)
+	type data struct {
+		*spec.ApiSpec
+		Pkg string
+	}
+	return t.Execute(file, data{api, pkg})
 }