ident: implement system identifier
Signed-off-by: Yonah <contrib@gensokyo.uk>
This commit is contained in:
23
ident/ident.go
Normal file
23
ident/ident.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Package ident is the reference implementation of system and member
|
||||
// identifiers.
|
||||
package ident
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// ErrNewline is returned for identifiers found to contain newline characters.
|
||||
var ErrNewline = errors.New("identifier contains newline characters")
|
||||
|
||||
// UnexpectedSizeError describes a malformed string representation of an
|
||||
// identifier, with unexpected length.
|
||||
type UnexpectedSizeError struct {
|
||||
Data []byte
|
||||
Want int
|
||||
}
|
||||
|
||||
func (e *UnexpectedSizeError) Error() string {
|
||||
return "got " + strconv.Itoa(len(e.Data)) + " bytes for " +
|
||||
"a " + strconv.Itoa(e.Want) + "-byte identifier"
|
||||
}
|
||||
Reference in New Issue
Block a user