]> Cypherpunks repositories - gostls13.git/commit
archive/tar: make Writer error handling consistent
authorJoe Tsai <joetsai@digital-static.net>
Tue, 15 Aug 2017 01:38:46 +0000 (18:38 -0700)
committerJoe Tsai <thebrokentoaster@gmail.com>
Wed, 16 Aug 2017 01:07:12 +0000 (01:07 +0000)
commitb9a79f32b19eac12f3e161a339a8c1b751e47320
tree9c24c999e6712be7dea7b9a185b770adf8ec9811
parent5c20ffbb2f8ede35af7700797281248c71968286
archive/tar: make Writer error handling consistent

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: Ian Lance Taylor <iant@golang.org>
src/archive/tar/writer.go
src/archive/tar/writer_test.go