Skip to content

Commit 42de57b

Browse files
author
chenjie
committed
update
1 parent ab0bd49 commit 42de57b

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

codegen/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func createBaseProject() {
183183
//pre check success
184184
fmt.Println("start create base project.")
185185

186-
statusapi.CreatePathAndFile()
186+
statusapi.CreatePathAndFile(*name)
187187
statusapi.Execute(*name)
188188

189189
config.CreatePathAndFile()

codegen/tml/api/status/template_status.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ message pingresp{
5050
//}`
5151

5252
const path = "./api/"
53-
const name = "status.proto"
53+
const name = "status_%s.proto"
5454

5555
var tml *template.Template
5656
var file *os.File
@@ -62,12 +62,12 @@ func init() {
6262
panic(fmt.Sprintf("create template for %s error:%s", path+name, e))
6363
}
6464
}
65-
func CreatePathAndFile() {
65+
func CreatePathAndFile(projectname string) {
6666
var e error
6767
if e = os.MkdirAll(path+"deps", 0755); e != nil {
6868
panic(fmt.Sprintf("make dir:%s error:%s", path, e))
6969
}
70-
file, e = os.OpenFile(path+name, os.O_TRUNC|os.O_CREATE|os.O_WRONLY, 0644)
70+
file, e = os.OpenFile(path+fmt.Sprintf(name, projectname), os.O_TRUNC|os.O_CREATE|os.O_WRONLY, 0644)
7171
if e != nil {
7272
panic(fmt.Sprintf("make file:%s error:%s", path+name, e))
7373
}

codegen/tml/gomod/template_gomod.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ const text = `module {{.}}
1111
go 1.16
1212
1313
require (
14-
github.com/chenjie199234/Config v0.0.8
15-
github.com/chenjie199234/Corelib v0.0.22
16-
github.com/chenjie199234/Discovery v0.0.8
14+
github.com/chenjie199234/Config v0.0.9
15+
github.com/chenjie199234/Corelib v0.0.23
16+
github.com/chenjie199234/Discovery v0.0.9
1717
github.com/fsnotify/fsnotify v1.4.9
1818
github.com/go-sql-driver/mysql v1.6.0
1919
github.com/segmentio/kafka-go v0.4.16

0 commit comments

Comments
 (0)