From 5f0835fae798ace56eb1458964bd3ac8a140cc67 Mon Sep 17 00:00:00 2001 From: James Phillips Date: Fri, 23 Sep 2016 17:44:14 -0700 Subject: [PATCH] Runs go-fmt (incidental to this PR). --- command/agent/gated_writer.go | 42 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/command/agent/gated_writer.go b/command/agent/gated_writer.go index 602f018a4d..2faccbbe24 100644 --- a/command/agent/gated_writer.go +++ b/command/agent/gated_writer.go @@ -29,28 +29,28 @@ func (w *GatedWriter) Flush() { } func (w *GatedWriter) Write(p []byte) (n int, err error) { - // Once we flush we no longer synchronize writers since there's - // no use of the internal buffer. This is the happy path. - w.lock.RLock() - if w.flush { - w.lock.RUnlock() - return w.Writer.Write(p) - } - w.lock.RUnlock() + // Once we flush we no longer synchronize writers since there's + // no use of the internal buffer. This is the happy path. + w.lock.RLock() + if w.flush { + w.lock.RUnlock() + return w.Writer.Write(p) + } + w.lock.RUnlock() - // Now take the write lock. - w.lock.Lock() - defer w.lock.Unlock() + // Now take the write lock. + w.lock.Lock() + defer w.lock.Unlock() - // Things could have changed between the locking operations, so we - // have to check one more time. - if w.flush { - return w.Writer.Write(p) - } + // Things could have changed between the locking operations, so we + // have to check one more time. + if w.flush { + return w.Writer.Write(p) + } - // Buffer up the written data. - p2 := make([]byte, len(p)) - copy(p2, p) - w.buf = append(w.buf, p2) - return len(p), nil + // Buffer up the written data. + p2 := make([]byte, len(p)) + copy(p2, p) + w.buf = append(w.buf, p2) + return len(p), nil }