Documentation ¶
Overview ¶
Borrowed from https://www.calhoun.io/creating-random-strings-in-go/
Index ¶
- func Clone[T any](v T) T
- func CloneFallible[T any](v T) (T, error)
- func DirectoryExists(path string) bool
- func Duration(d time.Duration, dicimal int) time.Duration
- func FileExists(path string) bool
- func HasPipedStdin() bool
- func IsTerminal() bool
- func MakeSimpleTable(out io.Writer, headings []string) (table *tablewriter.Table)
- func MkdirAll(pathname string) error
- func PathRelativeToCWD(path string) string
- func RandBytes(n int) ([]byte, error)
- func RandString(n int) (string, error)
- func ReadStdin(maxLength int) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clone ¶ added in v0.0.508
func Clone[T any](v T) T
Clone clones *public fields* in a structure. Private fields may or may not be copied, and private pointers may or may not point into the original object.
- this will panic if the structure is not serializable
- See CloneFallible
func CloneFallible ¶ added in v0.0.508
CloneFallible clones *public fields* in a structure. Private fields may or may not be copied, and private pointers may or may not point into the original object.
- returns an error if the structure is not serializable
- See Clone
func DirectoryExists ¶
func FileExists ¶
func IsTerminal ¶ added in v0.0.183
func IsTerminal() bool
func MakeSimpleTable ¶ added in v0.0.145
func MakeSimpleTable(out io.Writer, headings []string) (table *tablewriter.Table)
func PathRelativeToCWD ¶
func RandBytes ¶ added in v0.0.348
RandBytes generates random bytes of a given length See: https://stackoverflow.com/questions/35781197/generating-a-random-fixed-length-byte-array-in-go
func RandString ¶ added in v0.0.261
RandString returns a string of n bytes, consisting of ASCII letters or numbers.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.