Standard library / compress/zlib

compress/zlib.ErrDictionary

Sentinel indicating a mismatch between the dictionary identified by the ZLIB header and the supplied dictionary. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
var ErrDictionary error

Working Example

Example Snippetgo
package main
import (  "bytes"  "compress/zlib"  "errors"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}func dictPack(dict []byte) []byte {  var b bytes.Buffer  w, e := zlib.NewWriterLevelDict(&b, zlib.BestCompression, dict)  must(e)  _, e = w.Write([]byte("Go"))  must(e)  must(w.Close())  return b.Bytes()}func main() {  _, e := zlib.NewReaderDict(bytes.NewReader(dictPack([]byte("Go Go Go"))), []byte("wrong"))  fmt.Println(errors.Is(e, zlib.ErrDictionary))}
Go Reference