Documentation
¶
Overview ¶
Package utils contains various utility functions to use in other packages
Package utils contains various utility functions to use in other packages
Index ¶
- func Contains(target, list interface{}) bool
- func ContainsInString(target string, list []string) bool
- func DecryptAnsibleVault(fileContent []byte, secret string) []byte
- func GetExtension(path string) (string, error)
- func HandlePanic(r any, errMessage string)
- func LineCounter(path string, fallbackMinifiedFileLOC int) (int, error)
- func MergeMaps(map1, map2 map[string]interface{})
- func NextRandom() string
- func SortedKeys(mapToSort map[string]string) []string
- func SplitLines(content string) *[]string
- func ValidateUUID(id string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains(target, list interface{}) bool
Contains if a function to check if list contains target
func ContainsInString ¶
ContainsInString verifies if some string in list contains the specified target
func DecryptAnsibleVault ¶
DecryptAnsibleVault verifies if the fileContent is encrypted by ansible-vault. If yes, the function decrypts it
func GetExtension ¶
GetExtension gets the extension of a file path
func HandlePanic ¶
func LineCounter ¶
LineCounter returns the number of lines in a file For files with a .json extension, if the file is detected as minified JSON, it will Beautifying the JSON and return the number of lines in the formatted output For all other files, or non-minified JSON, it returns the actual number of lines in the file If an error occurs reading the file, fallbackMinifiedFileLOC is returned for minified JSON files
func SortedKeys ¶
SortedKeys returns a sorted slice with all map keys
func ValidateUUID ¶
ValidateUUID checks if the given id is valid by the format UUID using regex expression
Types ¶
This section is empty.