From 60a570d5a6736dcc958b26316383cf0d1d56b433 Mon Sep 17 00:00:00 2001 From: CodeLingo Bot Date: Tue, 5 Feb 2019 05:42:42 +0000 Subject: [PATCH] Fix error formatting based on best practices from Code Review Comments Signed-off-by: CodeLingo Bot --- io2/writer_to_reader_adapter_test.go | 4 ++-- net2/http2/simple_pool.go | 2 +- resource_pool/simple_resource_pool.go | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/io2/writer_to_reader_adapter_test.go b/io2/writer_to_reader_adapter_test.go index 6d50bd5..14e2b3a 100644 --- a/io2/writer_to_reader_adapter_test.go +++ b/io2/writer_to_reader_adapter_test.go @@ -315,7 +315,7 @@ func (wrself *WriterToReaderAdapterSuite) TestZlibEarlyError(c *C) { _, _ = w.Write([]byte(wrself.testData)) _ = w.Close() var finalOutput bytes.Buffer - btf := fmt.Errorf("Born to fail") + btf := fmt.Errorf("born to fail") finalDecompressor := NewWriterToReaderAdapter( func(a io.Reader) (io.Reader, error) { return nil, btf }, &finalOutput, true) @@ -369,7 +369,7 @@ func (wrself *WriterToReaderAdapterSuite) TestZlibWriteTruncation(c *C) { c.Assert(string(finalOutput.Bytes()) != (wrself.testData+wrself.testData), Equals, true) } -var lateFailing error = fmt.Errorf("LateFailing") +var lateFailing error = fmt.Errorf("lateFailing") type LateFailingZlibReader struct { rdr io.ReadCloser diff --git a/net2/http2/simple_pool.go b/net2/http2/simple_pool.go index aef2ca0..15fd762 100644 --- a/net2/http2/simple_pool.go +++ b/net2/http2/simple_pool.go @@ -18,7 +18,7 @@ import ( ) var ( - errFollowRedirectDisabled = fmt.Errorf("Following redirect disabled") + errFollowRedirectDisabled = fmt.Errorf("following redirect disabled") ) // Pool of persistent HTTP connections. The only limit is on the max # of idle connections we diff --git a/resource_pool/simple_resource_pool.go b/resource_pool/simple_resource_pool.go index 900ea47..a5f9e1d 100644 --- a/resource_pool/simple_resource_pool.go +++ b/resource_pool/simple_resource_pool.go @@ -104,7 +104,7 @@ func (p *simpleResourcePool) Register(resourceLocation string) error { if p.isLameDuck { return fmt.Errorf( - "Cannot register %s to lame duck resource pool", + "cannot register %s to lame duck resource pool", resourceLocation) } @@ -137,12 +137,12 @@ func (p *simpleResourcePool) getLocation() (string, error) { if p.location == "" { return "", fmt.Errorf( - "Resource location is not set for SimpleResourcePool") + "resource location is not set for SimpleResourcePool") } if p.isLameDuck { return "", fmt.Errorf( - "Lame duck resource pool cannot return handles to %s", + "lame duck resource pool cannot return handles to %s", p.location) } @@ -239,7 +239,7 @@ func (p *simpleResourcePool) Discard(handle ManagedHandle) error { if h != nil { atomic.AddInt32(p.numActive, -1) if err := p.options.Close(h); err != nil { - return fmt.Errorf("Failed to close resource handle: %v", err) + return fmt.Errorf("failed to close resource handle: %v", err) } } return nil