Documentation ¶
Overview ¶
Package util haters gonna hate.
Index ¶
- func BasePath(s string) string
- func BinaryCase(s string, n int) string
- func Camelcase(s string, v ...interface{}) string
- func CertDomainNames(s string) []string
- func ClearHeader(h http.Header)
- func DateSuffix(t time.Time) string
- func DecodeAlias(s string) string
- func Domain(s string) string
- func EncodeAlias(s string) string
- func Env(m map[string]string) (env []string)
- func Exists(path string) bool
- func ExitStatus(cmd *exec.Cmd, err error) string
- func Fatal(err error)
- func FixMultipleSetCookie(h http.Header)
- func Indent(s string) string
- func IsBucketExists(err error) bool
- func IsCI() bool
- func IsJSON(s string) bool
- func IsJSONLog(s string) bool
- func IsListening(u *url.URL) bool
- func IsNoCredentials(err error) bool
- func IsNotFound(err error) bool
- func IsThrottled(err error) bool
- func IsWildcardDomain(s string) bool
- func Log(msg string, v ...interface{})
- func LogClear(msg string, v ...interface{})
- func LogListItem(msg string, v ...interface{})
- func LogName(name, msg string, v ...interface{})
- func LogPad(msg string, v ...interface{})
- func LogTitle(msg string, v ...interface{})
- func ManagedByUp(s string) string
- func Md5(s string) string
- func Milliseconds(d time.Duration) int
- func MillisecondsSince(t time.Time) int
- func NewInlineProgressInt(total int) *progress.Bar
- func NewProgressInt(total int) *progress.Bar
- func Pad() func()
- func ParseDuration(s string) (d time.Duration, err error)
- func ParseSections(r io.Reader) (sections []string, err error)
- func PrefixLines(s string, prefix string) string
- func ReadFileJSON(path string, v interface{}) error
- func RemoveSubdomains(s string, n int) string
- func StringsContains(list []string, s string) bool
- func StripLerna(s string) string
- func ToFloat(v interface{}) float64
- func UniqueStrings(s []string) (v []string)
- func WaitForListen(u *url.URL, timeout time.Duration) error
- func WildcardMatches(wildcard, domain string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinaryCase ¶
BinaryCase ported from https://github.com/Gi60s/binary-case/blob/master/index.js#L86.
func CertDomainNames ¶
CertDomainNames returns the certificate domain name and alternative names for a requested domain.
func DecodeAlias ¶
DecodeAlias decodes an alias string which was encoded by the EncodeAlias function.
func EncodeAlias ¶
EncodeAlias encodes an alias string so that it conforms to the requirement of matching (?!^[0-9]+$)([a-zA-Z0-9-_]+).
func ExitStatus ¶
ExitStatus returns the exit status of cmd.
func FixMultipleSetCookie ¶
FixMultipleSetCookie staggers the casing of each set-cookie value to trick API Gateway into setting multiple in the response.
func IsBucketExists ¶
IsBucketExists returns true if err is not nil and represents an existing bucket.
func IsListening ¶
IsListening returns true if there's a server listening on `u`.
func IsNoCredentials ¶
IsNoCredentials returns true if err is not nil and represents missing credentials.
func IsNotFound ¶
IsNotFound returns true if err is not nil and represents a missing resource.
func IsThrottled ¶
IsThrottled returns true if err is not nil and represents a throttled request.
func IsWildcardDomain ¶
IsWildcardDomain returns true if the domain is a wildcard.
func LogClear ¶
func LogClear(msg string, v ...interface{})
LogClear clears the line and outputs a log message.
func LogName ¶
func LogName(name, msg string, v ...interface{})
LogName outputs a log message with name.
func Milliseconds ¶
Milliseconds returns the duration as milliseconds.
func MillisecondsSince ¶
MillisecondsSince returns the duration as milliseconds relative to time t.
func NewInlineProgressInt ¶
func NewInlineProgressInt(total int) *progress.Bar
NewInlineProgressInt with the given total.
func NewProgressInt ¶
func NewProgressInt(total int) *progress.Bar
NewProgressInt with the given total.
func ParseDuration ¶
ParseDuration string with day and month approximation support.
func ParseSections ¶
ParseSections returns INI style sections from r.
func PrefixLines ¶
PrefixLines prefixes the lines in s with prefix.
func ReadFileJSON ¶
ReadFileJSON reads json from the given path.
func RemoveSubdomains ¶
RemoveSubdomains returns the domain without the n left-most subdomain(s).
func StringsContains ¶
StringsContains returns true if list contains s.
func StripLerna ¶
StripLerna strips the owner portion of a Lerna-based tag. See #670 for details. They are in the form of "@owner/repo@0.5.0".
func UniqueStrings ¶
UniqueStrings returns a string slice of unique values.
func WaitForListen ¶
WaitForListen blocks until `u` is listening with timeout.
func WildcardMatches ¶
WildcardMatches returns true if wildcard is a wildcard domain and it satisfies the given domain.
Types ¶
This section is empty.