• Joe Tsai's avatar
    archive/tar: make Writer error handling consistent · b9a79f32
    Joe Tsai authored
    The Writer logic was not consistent about when an IO error would
    persist across multiple calls on Writer's methods.
    
    Thus, to make the error handling more consistent we always check
    the persistent state of the error prior to every exported method
    call, and return an error if set. Otherwise, it is the responsibility
    of every exported method to persist any fatal errors that may occur.
    
    As a simplification, we can remove the close field since that
    information can be represented by simply storing ErrWriteAfterClose
    in the err field.
    
    Change-Id: I8746ca36b3739803e0373253450db69b3bd12f38
    Reviewed-on: https://go-review.googlesource.com/55590
    Run-TryBot: Joe Tsai <joetsai@digital-static.net>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
    b9a79f32
writer.go 9.14 KB