diff options
author | Erik Dubbelboer <erik@dubbelboer.com> | 2021-12-13 16:41:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-13 09:41:34 +0100 |
commit | e9db537178708982f64736dbdedfddd2a168d395 (patch) | |
tree | 705174cc0a2f0dd156dc98b578f14b7616608eba /brotli_test.go | |
parent | Fix bad request trailer panic (diff) | |
download | fasthttp-e9db537178708982f64736dbdedfddd2a168d395.tar.gz fasthttp-e9db537178708982f64736dbdedfddd2a168d395.tar.bz2 fasthttp-e9db537178708982f64736dbdedfddd2a168d395.zip |
Use %w to wrap errors (#1175)
Diffstat (limited to 'brotli_test.go')
-rw-r--r-- | brotli_test.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/brotli_test.go b/brotli_test.go index 1ac94dd..a4efa05 100644 --- a/brotli_test.go +++ b/brotli_test.go @@ -42,7 +42,7 @@ func testBrotliBytesSingleCase(s string) error { unbrotliedS, err := AppendUnbrotliBytes(prefix, brotlipedS[len(prefix):]) if err != nil { - return fmt.Errorf("unexpected error when uncompressing %q: %s", s, err) + return fmt.Errorf("unexpected error when uncompressing %q: %w", s, err) } if !bytes.Equal(unbrotliedS[:len(prefix)], prefix) { return fmt.Errorf("unexpected prefix when uncompressing %q: %q. Expecting %q", s, unbrotliedS[:len(prefix)], prefix) @@ -83,17 +83,17 @@ func testBrotliCompressSingleCase(s string) error { var buf bytes.Buffer zw := acquireStacklessBrotliWriter(&buf, CompressDefaultCompression) if _, err := zw.Write([]byte(s)); err != nil { - return fmt.Errorf("unexpected error: %s. s=%q", err, s) + return fmt.Errorf("unexpected error: %w. s=%q", err, s) } releaseStacklessBrotliWriter(zw, CompressDefaultCompression) zr, err := acquireBrotliReader(&buf) if err != nil { - return fmt.Errorf("unexpected error: %s. s=%q", err, s) + return fmt.Errorf("unexpected error: %w. s=%q", err, s) } body, err := ioutil.ReadAll(zr) if err != nil { - return fmt.Errorf("unexpected error: %s. s=%q", err, s) + return fmt.Errorf("unexpected error: %w. s=%q", err, s) } if string(body) != s { return fmt.Errorf("unexpected string after decompression: %q. Expecting %q", body, s) |