Skip to content

Commit

Permalink
Use os.DevNull whenever possible
Browse files Browse the repository at this point in the history
  • Loading branch information
xyproto committed Jun 17, 2018
1 parent ef241fd commit 677135e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
)

// Output can be used for temporarily silencing stdout by redirecting to /dev/null or NUL
// Output can be used for temporarily silencing stdout by redirecting to os.DevNull ("/dev/null" or "NUL")
type Output struct {
stdout *os.File
enabled bool
Expand Down
6 changes: 3 additions & 3 deletions engine/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Available flags:
--limit=N Limit clients to N requests per second
(the default is ` + ac.defaultLimitString + `).
--nolimit Disable rate limiting.
--nodb No database backend. (same as --boltdb=/dev/null).
--nodb No database backend. (same as --boltdb=` + os.DevNull + `).
-l, --lua Don't serve anything, just present the Lua REPL.
-s, --server Server mode (disable debug + interactive mode).
-q, --quiet Don't output anything to stdout or stderr.
Expand Down Expand Up @@ -277,7 +277,7 @@ func (ac *Config) handleFlags(serverTempDir string) {
}

if noDatabase {
ac.boltFilename = "/dev/null"
ac.boltFilename = os.DevNull
}

// TODO: If flags are set in addition to -p or -e, don't override those
Expand All @@ -304,7 +304,7 @@ func (ac *Config) handleFlags(serverTempDir string) {
ac.cacheMode = cachemode.Development
} else if ac.simpleMode {
ac.useBolt = true
ac.boltFilename = "/dev/null"
ac.boltFilename = os.DevNull
ac.serveJustHTTP = true
ac.serverMode = true
ac.cacheMode = cachemode.Off
Expand Down
1 change: 0 additions & 1 deletion engine/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,6 @@ func (ac *Config) REPL(ready, done chan bool) error {
continue
}
}

if EOF {
if ac.ctrldTwice {
switch EOFcount {
Expand Down
2 changes: 1 addition & 1 deletion engine/serverconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (ac *Config) Info() string {
if len(ac.serverConfigurationFilenames) > 0 {
buf.WriteString(fmt.Sprintf("Server configuration:\t%v\n", ac.serverConfigurationFilenames))
}
if ac.internalLogFilename != "/dev/null" {
if ac.internalLogFilename != os.DevNull {
buf.WriteString("Internal log file:\t" + ac.internalLogFilename + "\n")
}
infoString := buf.String()
Expand Down

0 comments on commit 677135e

Please sign in to comment.