ident: implement system identifier

Signed-off-by: Yonah <contrib@gensokyo.uk>
This commit is contained in:
2026-03-21 17:05:55 +09:00
parent 3f5c3c8ff9
commit f609d5bb62
4 changed files with 272 additions and 0 deletions

23
ident/ident.go Normal file
View 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"
}