aboutsummaryrefslogtreecommitdiffhomepage
path: root/hst/instance.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-03-11 19:21:55 +0900
committerOphestra <cat@gensokyo.uk>2026-03-11 19:21:55 +0900
commit330a344845aa8653772a9be6c085f4fdb602a028 (patch)
tree7ed7f60ad70121be51289cbe9043c003d1940e19 /hst/instance.go
parent48cdf8bf852234ea3dad8dad3d571bb1d9546c32 (diff)
hst: improve doc comments
These now read a lot better both in source and on pkgsite. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst/instance.go')
-rw-r--r--hst/instance.go15
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 {