core

package
v0.0.0-...-22ede9b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRecursiveDir

func CreateRecursiveDir(completePath string) error

CreateRecursiveDir Create directory structure recursively, if they do not exist @parameters completePath - Complete path of directory which needs to be created @returns Error - Errors if any. Otherwise, returns nil

func DeleteFiles

func DeleteFiles(path string, wildCard string)

DeleteFiles Delete all the files and dirs recursively in specified directory @parameters path - Directory whose contents need to be deleted wildcard - patterns to match the filenames (e.g. '*')

func DeleteTmpDir

func DeleteTmpDir(outputDir string) error

DeleteTmpDir Delete the temporary directory @parameters outputDir - Directory which need to be deleted @returns Error - Errors if any. Otherwise, returns nil

func GetCurrentTime

func GetCurrentTime() string

func GetEntropy

func GetEntropy(data string) (entropy float64)

func GetHash

func GetHash(s string) string

func GetJSONFilepath

func GetJSONFilepath(jsonFilename, outputPath string) (string, error)

GetJSONFilepath Return complete path and filename for json output file @parameters image - Name of the container image or dir, for which json filename and path will be created @returns string - Sanitized string which can used as path and filename of json output file Error - Errors if path can't be created. Otherwise, returns nil

func GetTimestamp

func GetTimestamp() int64

func GetTmpDir

func GetTmpDir(imageName, tempDirectory string) (string, error)

GetTmpDir Create a temporrary directory to extract the conetents of container image @parameters imageName - Name of the container image @returns String - Complete path of the based directory where image will be extracted, empty string if error Error - Errors if any. Otherwise, returns nil

func IsSkippableDir

func IsSkippableDir(excludedPaths []string, path, baseDir string) bool

IsSkippableDir Checks if the path is excluded

func IsSkippableFileExtension

func IsSkippableFileExtension(excludedExtensions []string, path string) bool

IsSkippableFileExtension Checks if the file extension is excluded

func IsSymLink(path string) bool

IsSymLink Check if input is a symLink, not normal file/dir path - Pathname which needs to be checked for symbolic link @returns bool - Return true if input is a symLink

func LogIfError

func LogIfError(text string, err error)

func PathExists

func PathExists(path string) bool

func Pluralize

func Pluralize(count int, singular string, plural string) string

func UpdateDirsPermissionsRW

func UpdateDirsPermissionsRW(dir string) error

UpdateDirsPermissionsRW Update permissions for dirs in container images, so that they can be properly deleted

Types

type MatchFile

type MatchFile struct {
	Path      string
	Filename  string
	Extension string
	Contents  []byte
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL