💡 Improve go doc comments with internal links

This commit is contained in:
Dan Jones 2025-03-31 12:10:05 -05:00
commit c5a9f09166
8 changed files with 38 additions and 34 deletions

View file

@ -9,7 +9,7 @@ import (
)
// UUIDer is an interface for generating UUIDs.
// It is recommended that you use either the UUIDv4 or UUIDv7 variables.
// It is recommended that you use either the [UUIDv4] or [UUIDv7] variables.
type UUIDer interface {
UUID() (uuid.UUID, error)
}
@ -17,7 +17,7 @@ type UUIDer interface {
// UUIDFunc is a function that generates a UUID.
type UUIDFunc func() (uuid.UUID, error)
// UUID allows UUIDFunc to be used as a UUIDer.
// UUID allows [UUIDFunc] to be used as a [UUIDer].
func (u UUIDFunc) UUID() (uuid.UUID, error) {
return u()
}
@ -33,7 +33,7 @@ var (
UUIDv7 = UUIDFunc(uuid.NewV7)
)
// UUID generates a UUID. If nil.is passed as an argument,
// UUID generates a UUID. If nil is passed as an argument,
// a UUIDv4 is generated.
func UUID(u UUIDer) Generator {
if u == nil {
@ -52,10 +52,10 @@ type randConf struct {
length int
}
// RandomOption is an option for the Random Generator.
// RandomOption is an option for the [Random] [Generator].
type RandomOption func(*randConf)
// RandomLength controls the length of the string generated by Random.
// RandomLength controls the length of the string generated by [Random].
func RandomLength(length int) RandomOption {
return func(c *randConf) {
c.length = length
@ -75,7 +75,7 @@ func fillBuffer(buff *strings.Builder, length int) {
}
}
// Random generates a random string containing the characters [A-Za-z0-9].
// Random generates a random string containing the characters A-Za-z0-9.
// By default, it will be eight characters long.
func Random(opts ...RandomOption) Generator {
c := randConf{8}