Standard library / archive/tar

archive/tar.ErrWriteTooLong

Writing beyond the current header Size returns this sentinel. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
var ErrWriteTooLong error

Working 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.WriteHeader(&tar.Header{Name: "a", Size: 1}))  _, e := w.Write([]byte("Go"))  fmt.Println(errors.Is(e, tar.ErrWriteTooLong))}
Go Reference