• Joe Tsai's avatar
    compress/flate: make huffmanBitWriter errors persistent · 8cd04da7
    Joe Tsai authored
    For persistent error handling, the methods of huffmanBitWriter have to be
    consistent about how they check errors. It must either consistently
    check error *before* every operation OR immediately *after* every
    operation. Since most of the current logic uses the previous approach,
    we apply the same style of error checking to writeBits and all calls
    to Write such that they only operate if w.err is already nil going
    into them.
    
    The error handling approach is brittle and easily broken by future commits to
    the code. In the near future, we should switch the logic to use panic at the
    lowest levels and a recover at the edge of the public API to ensure
    that errors are always persistent.
    
    Fixes #16749
    
    Change-Id: Ie1d83e4ed8842f6911a31e23311cd3cbf38abe8c
    Reviewed-on: https://go-review.googlesource.com/27200Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    8cd04da7
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...