Skip to content

Commit 48383f0

Browse files
authored
APP-34433: Small bug fix and bit cleaner example (#45)
* fix: s/Fprintln/Fprint/ - don't add newline when printing * chore: clean up example * chore: update comment * chore: update the version for the sake of patching
1 parent d8c9e01 commit 48383f0

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

examples/main.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ func main() {
1818
if err != nil {
1919
panic(err)
2020
}
21-
// Old default way, still works
22-
//dumpExec := dump.Exec(pg.ExecOptions{StreamPrint: false})
2321

24-
// Note that any io.Writer could be assigned to StreamDestination. For simplicity, I'm just using stdout here.
25-
// But we could write to a unix fifo file, a database, a RabbitMQ queue or whatever
22+
dump.EnableVerbose()
23+
24+
// Default options
25+
//dumpExec := dump.Exec(pg.ExecOptions{})
26+
27+
// Log to stdout
28+
// Note that any io.Writer could be assigned to StreamDestination. I'm just using stdout here for brevity.
29+
// But we could write to a file, a database, a RabbitMQ queue or whatever
2630
// We could even write to all of the above using io.MultiWriter(...)
2731
dumpExec := dump.Exec(pg.ExecOptions{StreamPrint: true, StreamDestination: os.Stdout})
2832
if dumpExec.Error != nil {

utils.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func streamExecOutput(out io.ReadCloser, options ExecOptions) (string, error) {
2727
}
2828

2929
if options.StreamPrint {
30-
_, err = fmt.Fprintln(options.StreamDestination, line)
30+
_, err = fmt.Fprint(options.StreamDestination, line)
3131
if err != nil {
3232
return output, fmt.Errorf("error writing output: %w", err)
3333
}

0 commit comments

Comments
 (0)