Skip to content

Commit e3d3a7a

Browse files
committed
Don't add trailing blank line to dbscheme
1 parent 431b73a commit e3d3a7a

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

go/extractor/dbscheme/dbscheme.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,17 +415,19 @@ func AddDefaultSnippet(snippet string) bool {
415415

416416
// PrintDbScheme prints the schema of this database to the writer `w`
417417
func PrintDbScheme(w io.Writer) {
418-
fmt.Fprintf(w, "/** Auto-generated dbscheme; do not edit. Run `make gen` in directory `go/` to regenerate. */\n\n")
418+
var b strings.Builder
419+
fmt.Fprintf(&b, "/** Auto-generated dbscheme; do not edit. Run `make gen` in directory `go/` to regenerate. */\n\n")
419420
for _, snippet := range defaultSnippets {
420-
fmt.Fprintf(w, "%s\n", snippet)
421+
fmt.Fprintf(&b, "%s\n", snippet)
421422
}
422423
for _, table := range tables {
423-
fmt.Fprintf(w, "%s\n\n", table.String())
424+
fmt.Fprintf(&b, "%s\n\n", table.String())
424425
}
425426
for _, tp := range types {
426427
def := tp.def()
427428
if def != "" {
428-
fmt.Fprintf(w, "%s\n\n", def)
429+
fmt.Fprintf(&b, "%s\n\n", def)
429430
}
430431
}
432+
fmt.Fprintln(w, strings.TrimRight(b.String(), "\n"))
431433
}

0 commit comments

Comments
 (0)