Standard library / archive/tar
archive/tar.ErrWriteAfterClose
Writing after successful writer finalization returns this sentinel. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
var ErrWriteAfterClose errorWorking Example
Example Snippetgo
package main
import ( "archive/tar" "bytes" "errors" "fmt")
func must(e error) { if e != nil { panic(e) }}
func main() { var b bytes.Buffer w := tar.NewWriter(&b) must(w.Close()) _, e := w.Write([]byte("x")) fmt.Println(errors.Is(e, tar.ErrWriteAfterClose))}