Standard library / encoding/hex

encoding/hex.ErrLength

Sentinel for odd-length hexadecimal input in nonstreaming decode APIs. Streaming decoding can report io.ErrUnexpectedEOF instead. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
var ErrLength error

Working Example

Example Snippetgo
package main
import (  "encoding/hex"  "errors"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() { _, e := hex.DecodeString("a"); fmt.Println(errors.Is(e, hex.ErrLength)) }
Go Reference