Skip to content

Commit

Permalink
remove unconditional write to stdout
Browse files Browse the repository at this point in the history
Writiting to the stdout unconditionally is noisy and inflexible.
The caller is in a better position to decide if anything should
be printed to stdout, and it can already do that. So remove the
uncoditional write from the Generate function.

Don't add anything to vfsgendev, keeping it quiet when everything
is successful. This is consistent with various Go code generators
like stringer, and testing it out over the last few weeks did not
make me feel like something is missing. It's also more consistent
with the philosophy for Unix and Plan 9 tools, where it's nice to
be quiet when all goes as planned.

For #81.
  • Loading branch information
dmitshur committed Jun 27, 2020
1 parent cf84b0e commit 92b8a71
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"compress/gzip"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -48,7 +47,6 @@ func Generate(input http.FileSystem, opt Options) error {
}

// Write output file (all at once).
fmt.Println("writing", opt.Filename)
err = ioutil.WriteFile(opt.Filename, buf.Bytes(), 0644)
return err
}
Expand Down

0 comments on commit 92b8a71

Please sign in to comment.