aboutsummaryrefslogtreecommitdiff
path: root/src/log
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2016-02-28 15:52:49 -0800
committerBrad Fitzpatrick <bradfitz@golang.org>2016-02-29 03:31:19 +0000
commit351c15f1cee364a91ef606ef9114d55247a6a0c2 (patch)
tree8dcea615817f3a640786e55a4ebcfe75306abe77 /src/log
parent28ce6f3600fd87a1ae39c492ee56307f0be3c32f (diff)
downloadgo-351c15f1cee364a91ef606ef9114d55247a6a0c2.tar.gz
go-351c15f1cee364a91ef606ef9114d55247a6a0c2.zip
all: remove public named return values when useless
Named returned values should only be used on public funcs and methods when it contributes to the documentation. Named return values should not be used if they're only saving the programmer a few lines of code inside the body of the function, especially if that means there's stutter in the documentation or it was only there so the programmer could use a naked return statement. (Naked returns should not be used except in very small functions) This change is a manual audit & cleanup of public func signatures. Signatures were not changed if: * the func was private (wouldn't be in public godoc) * the documentation referenced it * the named return value was an interesting name. (i.e. it wasn't simply stutter, repeating the name of the type) There should be no changes in behavior. (At least: none intended) Change-Id: I3472ef49619678fe786e5e0994bdf2d9de76d109 Reviewed-on: https://go-review.googlesource.com/20024 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
Diffstat (limited to 'src/log')
-rw-r--r--src/log/syslog/syslog.go34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/log/syslog/syslog.go b/src/log/syslog/syslog.go
index 0e342242ec..f489059d5a 100644
--- a/src/log/syslog/syslog.go
+++ b/src/log/syslog/syslog.go
@@ -103,7 +103,7 @@ type netConn struct {
// New establishes a new connection to the system log daemon. Each
// write to the returned writer sends a log message with the given
// priority and prefix.
-func New(priority Priority, tag string) (w *Writer, err error) {
+func New(priority Priority, tag string) (*Writer, error) {
return Dial("", "", priority, tag)
}
@@ -187,57 +187,57 @@ func (w *Writer) Close() error {
// Emerg logs a message with severity LOG_EMERG, ignoring the severity
// passed to New.
-func (w *Writer) Emerg(m string) (err error) {
- _, err = w.writeAndRetry(LOG_EMERG, m)
+func (w *Writer) Emerg(m string) error {
+ _, err := w.writeAndRetry(LOG_EMERG, m)
return err
}
// Alert logs a message with severity LOG_ALERT, ignoring the severity
// passed to New.
-func (w *Writer) Alert(m string) (err error) {
- _, err = w.writeAndRetry(LOG_ALERT, m)
+func (w *Writer) Alert(m string) error {
+ _, err := w.writeAndRetry(LOG_ALERT, m)
return err
}
// Crit logs a message with severity LOG_CRIT, ignoring the severity
// passed to New.
-func (w *Writer) Crit(m string) (err error) {
- _, err = w.writeAndRetry(LOG_CRIT, m)
+func (w *Writer) Crit(m string) error {
+ _, err := w.writeAndRetry(LOG_CRIT, m)
return err
}
// Err logs a message with severity LOG_ERR, ignoring the severity
// passed to New.
-func (w *Writer) Err(m string) (err error) {
- _, err = w.writeAndRetry(LOG_ERR, m)
+func (w *Writer) Err(m string) error {
+ _, err := w.writeAndRetry(LOG_ERR, m)
return err
}
// Warning logs a message with severity LOG_WARNING, ignoring the
// severity passed to New.
-func (w *Writer) Warning(m string) (err error) {
- _, err = w.writeAndRetry(LOG_WARNING, m)
+func (w *Writer) Warning(m string) error {
+ _, err := w.writeAndRetry(LOG_WARNING, m)
return err
}
// Notice logs a message with severity LOG_NOTICE, ignoring the
// severity passed to New.
-func (w *Writer) Notice(m string) (err error) {
- _, err = w.writeAndRetry(LOG_NOTICE, m)
+func (w *Writer) Notice(m string) error {
+ _, err := w.writeAndRetry(LOG_NOTICE, m)
return err
}
// Info logs a message with severity LOG_INFO, ignoring the severity
// passed to New.
-func (w *Writer) Info(m string) (err error) {
- _, err = w.writeAndRetry(LOG_INFO, m)
+func (w *Writer) Info(m string) error {
+ _, err := w.writeAndRetry(LOG_INFO, m)
return err
}
// Debug logs a message with severity LOG_DEBUG, ignoring the severity
// passed to New.
-func (w *Writer) Debug(m string) (err error) {
- _, err = w.writeAndRetry(LOG_DEBUG, m)
+func (w *Writer) Debug(m string) error {
+ _, err := w.writeAndRetry(LOG_DEBUG, m)
return err
}