Documentation
Index ¶
- Constants
- func EnsureAbsolutePath(path string, absoluteBase string) string
- func ExistsInSlice(target string, slice []string) bool
- func GetDirectorySize(path string) (int64, error)
- func IsEmptyString(s string) bool
- func IsEqualSlice(target []string, source []string) bool
- func IsInt64InSlice(target int64, slice []int64) bool
- func IsSliceInt64Eq(a, b []int64) bool
- func IsStringInSlice(target string, slice []string) bool
- func Max(a, b int) int
- func Min(a, b int) int
- func NormalizeEOL(input []byte) []byte
- func PathEscapeSegments(path string) string
- func Remove(name string) error
- func RemoveAll(name string) error
- func SanitizeMessage(message, unsanitizedURL string) string
- func SanitizeURLCredentials(unsanitizedURL string, usePlaceholder bool) string
- func ShellEscape(toEscape string) string
- func StopTimer(t *time.Timer) bool
- func URLJoin(base string, elems ...string) string
- func URLSanitizedError(err error, unsanitizedURL string) error
- type Int64Slice
- type OptionalBool
Constants ¶
const ( // OptionalBoolNone a "null" boolean value OptionalBoolNone = iota // OptionalBoolTrue a "true" boolean value OptionalBoolTrue // OptionalBoolFalse a "false" boolean value OptionalBoolFalse )
Variables ¶
Functions ¶
func EnsureAbsolutePath ¶
EnsureAbsolutePath ensure that a path is absolute, making it relative to absoluteBase if necessary
func ExistsInSlice ¶
ExistsInSlice returns true if string exists in slice.
func GetDirectorySize ¶
GetDirectorySize returns the dumb disk consumption for a given path
func IsEmptyString ¶
IsEmptyString checks if the provided string is empty
func IsEqualSlice ¶
IsEqualSlice returns true if slices are equal.
func IsInt64InSlice ¶
IsInt64InSlice sequential searches if int64 exists in slice.
func IsSliceInt64Eq ¶
IsSliceInt64Eq returns if the two slice has the same elements but different sequences.
func IsStringInSlice ¶
IsStringInSlice sequential searches if string exists in slice.
func NormalizeEOL ¶
NormalizeEOL will convert Windows (CRLF) and Mac (CR) EOLs to UNIX (LF)
func PathEscapeSegments ¶
PathEscapeSegments escapes segments of a path while not escaping forward slash
func RemoveAll ¶
RemoveAll removes the named file or (empty) directory with at most 5 attempts.Remove
func SanitizeMessage ¶
SanitizeMessage sanitizes a message which may contains a sensitive URL
func SanitizeURLCredentials ¶
SanitizeURLCredentials sanitizes a url, either removing user credentials or replacing them with a placeholder.
func ShellEscape ¶
ShellEscape will escape the provided string. We can't just use go-shellquote here because our preferences for escaping differ from those in that we want:
* If the string doesn't require any escaping just leave it as it is. * If the string requires any escaping prefer double quote escaping * If we have ! or newlines then we need to use single quote escaping
func URLSanitizedError ¶
URLSanitizedError returns the sanitized version an error whose message may contain a sensitive URL
Types ¶
type Int64Slice ¶
type Int64Slice []int64
Int64Slice attaches the methods of Interface to []int64, sorting in increasing order.
func (Int64Slice) Len ¶
func (p Int64Slice) Len() int
func (Int64Slice) Less ¶
func (p Int64Slice) Less(i, j int) bool
func (Int64Slice) Swap ¶
func (p Int64Slice) Swap(i, j int)
type OptionalBool ¶
type OptionalBool byte
OptionalBool a boolean that can be "null"
func OptionalBoolOf ¶
func OptionalBoolOf(b bool) OptionalBool
OptionalBoolOf get the corresponding OptionalBool of a bool
func (OptionalBool) IsFalse ¶
func (o OptionalBool) IsFalse() bool
IsFalse return true if equal to OptionalBoolFalse
func (OptionalBool) IsNone ¶
func (o OptionalBool) IsNone() bool
IsNone return true if equal to OptionalBoolNone
func (OptionalBool) IsTrue ¶
func (o OptionalBool) IsTrue() bool
IsTrue return true if equal to OptionalBoolTrue