close output file after write
This commit is contained in:
parent
0f22ab3e39
commit
b03a77d2b7
6
TDL.go
6
TDL.go
|
@ -26,7 +26,7 @@ func checkUsage(debugFlag string, args []string) {
|
|||
}
|
||||
}
|
||||
|
||||
func outfile(infile string) io.Writer {
|
||||
func outfile(infile string) *os.File {
|
||||
basename := path.Base(infile)
|
||||
extension := path.Ext(basename)
|
||||
basename = strings.TrimSuffix(basename, extension)
|
||||
|
@ -67,7 +67,9 @@ func main() {
|
|||
if stdout {
|
||||
writer = os.Stdout
|
||||
} else {
|
||||
writer = outfile(filename)
|
||||
out := outfile(filename)
|
||||
defer out.Close()
|
||||
writer = out
|
||||
}
|
||||
generator := NewStdGenerator(writer)
|
||||
generator.Generate(parsed)
|
||||
|
|
Loading…
Reference in New Issue
Block a user