diff options
Diffstat (limited to 'hst/instance.go')
| -rw-r--r-- | hst/instance.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/hst/instance.go b/hst/instance.go index b59a7684..282472ae 100644 --- a/hst/instance.go +++ b/hst/instance.go @@ -12,10 +12,12 @@ import ( // An ID is a unique identifier held by a running hakurei container. type ID [16]byte -// ErrIdentifierLength is returned when encountering a [hex] representation of [ID] with unexpected length. +// ErrIdentifierLength is returned when encountering a [hex] representation of +// [ID] with unexpected length. var ErrIdentifierLength = errors.New("identifier string has unexpected length") -// IdentifierDecodeError is returned by [ID.UnmarshalText] to provide relevant error descriptions. +// IdentifierDecodeError is returned by [ID.UnmarshalText] to provide relevant +// error descriptions. type IdentifierDecodeError struct{ Err error } func (e IdentifierDecodeError) Unwrap() error { return e.Err } @@ -23,7 +25,10 @@ func (e IdentifierDecodeError) Error() string { var invalidByteError hex.InvalidByteError switch { case errors.As(e.Err, &invalidByteError): - return fmt.Sprintf("got invalid byte %#U in identifier", rune(invalidByteError)) + return fmt.Sprintf( + "got invalid byte %#U in identifier", + rune(invalidByteError), + ) case errors.Is(e.Err, hex.ErrLength): return "odd length identifier hex string" @@ -41,7 +46,9 @@ func (a *ID) CreationTime() time.Time { } // NewInstanceID creates a new unique [ID]. -func NewInstanceID(id *ID) error { return newInstanceID(id, uint64(time.Now().UnixNano())) } +func NewInstanceID(id *ID) error { + return newInstanceID(id, uint64(time.Now().UnixNano())) +} // newInstanceID creates a new unique [ID] with the specified timestamp. func newInstanceID(id *ID, p uint64) error { |
