Skip to content

Commit 3560889

Browse files
feat:
- outPath parameter fixed - Print content fixed
1 parent 36bab21 commit 3560889

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

options/options_generator.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"html/template"
2828
"log"
2929
"os"
30+
"path"
3031
"reflect"
3132
"strings"
3233
)
@@ -154,7 +155,7 @@ func (g *Generator) OutputToFile() {
154155
if err != nil {
155156
log.Fatal(err)
156157
}
157-
fmt.Printf("Generating Functional Options Code Successful.\nOut: %s\n", g.outPath)
158+
fmt.Printf("Generating Functional Options Code Successfully.\nOut: %s\n", g.outPath)
158159
}
159160

160161
func (g *Generator) forMart() []byte {
@@ -166,9 +167,10 @@ func (g *Generator) forMart() []byte {
166167
}
167168

168169
func (g *Generator) SetOutPath(outPath *string) {
170+
fileName := fmt.Sprintf("opt_%s_gen.go", stringx.CamelToSnake(g.StructInfo.StructName))
169171
if len(*outPath) > 0 {
170-
g.outPath = *outPath
172+
g.outPath = path.Join(*outPath, fileName)
171173
} else {
172-
g.outPath = fmt.Sprintf("opt_%s_gen.go", stringx.CamelToSnake(g.StructInfo.StructName))
174+
g.outPath = fileName
173175
}
174176
}

0 commit comments

Comments
 (0)