@@ -25,7 +25,7 @@ var structName = goopt.String([]string{"--struct"}, "", "name to set for struct"
25
25
var jsonAnnotation = goopt .Flag ([]string {"--json" }, []string {"--no-json" }, "Add json annotations (default)" , "Disable json annotations" )
26
26
var gormAnnotation = goopt .Flag ([]string {"--gorm" }, []string {}, "Add gorm annotations (tags)" , "" )
27
27
var gureguTypes = goopt .Flag ([]string {"--guregu" }, []string {}, "Add guregu null types" , "" )
28
- var targetDirectory = goopt .String ([]string {"--target" }, "" , "Save file path" )
28
+ var targetFile = goopt .String ([]string {"--target" }, "" , "Save file path" )
29
29
30
30
func init () {
31
31
goopt .OptArg ([]string {"-p" , "--password" }, "" , "Mysql password" , getMariadbPassword )
@@ -106,8 +106,8 @@ func main() {
106
106
fmt .Println ("Error in creating struct from json: " + err .Error ())
107
107
return
108
108
}
109
- if targetDirectory != nil {
110
- file , err := os .OpenFile (* targetDirectory , os .O_WRONLY | os .O_CREATE , os .ModeAppend )
109
+ if targetFile != nil && * targetFile != "" {
110
+ file , err := os .OpenFile (* targetFile , os .O_APPEND | os .O_CREATE | os .O_WRONLY , 0644 )
111
111
if err != nil {
112
112
fmt .Println ("Open File fail: " + err .Error ())
113
113
return
0 commit comments