diff --git a/cmd/edmgen/cmd.go b/cmd/edmgen/cmd.go index 5b9cb95..fac4352 100644 --- a/cmd/edmgen/cmd.go +++ b/cmd/edmgen/cmd.go @@ -162,7 +162,6 @@ func writeFileTxt(filename string, lines []string) error { if err != nil { return fmt.Errorf("failed to create file: %s", err) } - defer f.Close() for _, line := range lines { _, err := f.WriteString(line + "\n") @@ -171,7 +170,7 @@ func writeFileTxt(filename string, lines []string) error { } } - return nil + return f.Close() } func writeFileCsv(filename string, lines []string) error { @@ -179,7 +178,6 @@ func writeFileCsv(filename string, lines []string) error { if err != nil { return fmt.Errorf("failed to create file: %s", err) } - defer f.Close() w := csv.NewWriter(f) defer w.Flush() @@ -190,5 +188,5 @@ func writeFileCsv(filename string, lines []string) error { } } - return nil + return f.Close() } diff --git a/cmd/edmgen/logging.go b/cmd/edmgen/logging.go index fcb04db..69af215 100644 --- a/cmd/edmgen/logging.go +++ b/cmd/edmgen/logging.go @@ -21,21 +21,17 @@ func (l logging) print(str string) { } func (l logging) printHeader(str string) { - l.logger.Print(fmt.Sprintf("> %s", str)) + l.logger.Printf("> %s", str) } func (l logging) printResult(str string) { - l.logger.Print(fmt.Sprintf(" %s", str)) + l.logger.Printf(" %s", str) } func (l logging) printfResult(format string, args interface{}) { l.printResult(fmt.Sprintf(format, args)) } -func (l logging) printWarn(str string) { - l.logger.Print(fmt.Sprintf("[!] %s", str)) -} - -func (l logging) printFatal(str string) { +func (logging) printFatal(str string) { panic(str) }