Documentation ¶
Index ¶
- Variables
- func AsyncMultiWriter(writers ...io.Writer) io.Writer
- func CalcChecksums(reader io.Reader, checksumType ...Algorithm) (map[Algorithm]string, error)
- func CleanOldDirs() error
- func CopyDir(fromPath, toPath string, includeDirs bool, excludeNames []string) error
- func CopyFile(dst, src string) (err error)
- func CreateDirIfNotExist(path string) error
- func CreateExtractorPropsFile(extractorConfPath, buildInfoPath, buildName, buildNumber string, ...) (string, error)
- func CreateFilePath(localPath, fileName string) (string, error)
- func CreateTempBuildFile(buildName, buildNumber, projectKey, buildsDirPath string, logger Log) (*os.File, error)
- func CreateTempDir() (string, error)
- func DoubleWinPathSeparator(filePath string) string
- func DownloadDependencies(downloadTo, filename, relativeFilePath string, ...) error
- func DownloadFile(downloadTo string, fromUrl string) (err error)
- func FindFileInDirAndParents(dirPath, fileName string) (string, error)
- func GetBuildDir(buildName, buildNumber, projectKey, buildsDirPath string) (string, error)
- func GetCachePath() (string, error)
- func GetDependenciesGraph(projectDir string, log Log) (map[string][]string, error)
- func GetDependenciesList(projectDir string, log Log) (map[string]bool, error)
- func GetFileAndDirFromPath(path string) (fileName, dir string)
- func GetFileChecksums(filePath string) (md5, sha1, sha2 string, err error)
- func GetFileContentAndInfo(filePath string) (fileContent []byte, fileInfo os.FileInfo, err error)
- func GetFileInfo(path string, followSymlink bool) (fileInfo os.FileInfo, err error)
- func GetFileSeparator() string
- func GetGoModCachePath() (string, error)
- func GetModuleNameByDir(projectDir string, log Log) (string, error)
- func GetParsedGoVersion() (*version.Version, error)
- func GetPartialsBuildDir(buildName, buildNumber, projectKey, buildsDirPath string) (string, error)
- func GetProjectRoot() (string, error)
- func GetRegExp(regex string) (*regexp.Regexp, error)
- func IsDirExists(path string, followSymlink bool) (bool, error)
- func IsFileExists(path string, followSymlink bool) (bool, error)
- func IsFileSymlink(file os.FileInfo) bool
- func IsLinux() bool
- func IsPathExists(path string) bool
- func IsPathSymlink(path string) bool
- func IsWindows() bool
- func ListFiles(path string, includeDirs bool) ([]string, error)
- func ListFilesByFilterFunc(path string, filterFunc func(filePath string) (bool, error)) ([]string, error)
- func MoveDir(fromPath, toPath string) error
- func MoveFile(sourcePath, destPath string) (err error)
- func NewDefaultLogger(logLevel LevelType) *defaultLogger
- func ReadNLines(path string, total int) (lines []string, err error)
- func RemoveTempDir(dirPath string) error
- func RunGo(goArg []string, repoUrl string) error
- func UnixToWinPathSeparator(filePath string) string
- func Unmarshal(filePath string, loadTarget interface{}) (err error)
- func WinToUnixPathSeparator(filePath string) string
- type Algorithm
- type Command
- type FileDetails
- type LevelType
- type Log
- type NullLog
Constants ¶
This section is empty.
Variables ¶
var ErrShortWrite = errors.New("short write")
Functions ¶
func AsyncMultiWriter ¶ added in v0.1.5
AsyncMultiWriter creates a writer that duplicates its writes to all the provided writers asynchronous
func CalcChecksums ¶ added in v0.1.5
CalcChecksums calculates all hashes at once using AsyncMultiWriter. The file is therefore read only once.
func CleanOldDirs ¶ added in v0.1.5
func CleanOldDirs() error
Old runs/tests may leave junk at temp dir. Each temp file/Dir is named with prefix+timestamp, search for all temp files/dirs that match the common prefix and validate their timestamp.
func CopyDir ¶ added in v1.0.0
Copy directory content from one path to another. includeDirs means to copy also the dirs if presented in the src folder. excludeNames - Skip files/dirs in the src folder that match names in provided slice. ONLY excludes first layer (only in src folder).
func CreateDirIfNotExist ¶ added in v1.0.0
func CreateExtractorPropsFile ¶
func CreateExtractorPropsFile(extractorConfPath, buildInfoPath, buildName, buildNumber string, buildTimestamp time.Time, project string, configProperties map[string]string) (string, error)
Save all the extractor's properties into a local file. extractorConfPath - Path to a file to which all the extractor's properties will be written. buildInfoPath - Path to a file to which the build-info data will be written. buildName - Build name of the current build. buildNumber - Build number of the current build. project - JFrog Project key of the current build configProperties - Data of the actual extractor's properties. Returns the extractor Config file path.
func CreateFilePath ¶ added in v1.0.0
func CreateTempBuildFile ¶
func CreateTempBuildFile(buildName, buildNumber, projectKey, buildsDirPath string, logger Log) (*os.File, error)
Create a temp file of build-info.
func CreateTempDir ¶ added in v0.1.5
CreateTempDir creates a temporary directory and returns its path.
func DoubleWinPathSeparator ¶
func DownloadDependencies ¶
func DownloadFile ¶
func FindFileInDirAndParents ¶ added in v1.0.0
FindFileInDirAndParents looks for a file named fileName in dirPath and its parents, and returns the path of the directory where it was found. dirPath must be a full path.
func GetBuildDir ¶
func GetCachePath ¶ added in v0.1.5
GetCachePath returns the location of downloads dir inside the GOMODCACHE
func GetDependenciesGraph ¶ added in v0.1.5
Runs 'go mod graph' command and returns map that maps dependencies to their child dependencies slice
func GetDependenciesList ¶ added in v0.1.5
Runs go list -f {{with .Module}}{{.Path}}:{{.Version}}{{end}} all command and returns map of the dependencies
func GetFileAndDirFromPath ¶ added in v1.0.0
Return the file's name and dir of a given path by finding the index of the last separator in the path. Support separators : "/" , "\\" and "\\\\"
func GetFileChecksums ¶ added in v0.1.5
func GetFileContentAndInfo ¶ added in v0.1.5
func GetFileInfo ¶ added in v1.0.0
Get the file info of the file in path. If path points at a symlink and `followSymlink == false`, return the file info of the symlink instead
func GetFileSeparator ¶ added in v1.0.0
func GetFileSeparator() string
func GetGoModCachePath ¶ added in v0.1.5
GetGoModCachePath returns the location of the go module cache
func GetModuleNameByDir ¶ added in v0.1.5
Runs 'go list -m' command and returns module name
func GetParsedGoVersion ¶ added in v1.8.5
func GetPartialsBuildDir ¶
func GetProjectRoot ¶ added in v0.1.5
Returns the root dir where the go.mod located.
func IsDirExists ¶
Check if path points at a directory. If path points at a symlink and `followSymlink == false`, function will return `false` regardless of the symlink target
func IsFileExists ¶
Check if path points at a file. If path points at a symlink and `followSymlink == false`, function will return `true` regardless of the symlink target
func IsFileSymlink ¶ added in v1.0.0
func IsPathSymlink ¶ added in v1.0.0
func ListFilesByFilterFunc ¶ added in v1.3.0
func ListFilesByFilterFunc(path string, filterFunc func(filePath string) (bool, error)) ([]string, error)
Return all files in the specified path who satisfy the filter func. Not recursive.
func MoveFile ¶ added in v1.0.0
GoLang: os.Rename() give error "invalid cross-device link" for Docker container with Volumes. MoveFile(source, destination) will work moving file between folders Therefore, we are using our own implementation (MoveFile) in order to rename files.
func NewDefaultLogger ¶
func NewDefaultLogger(logLevel LevelType) *defaultLogger
NewDefaultLogger creates a new logger with a given LogLevel. All logs are written to Stderr and output is written to Stdout.
func ReadNLines ¶ added in v1.1.0
strip '\n' or read until EOF, return error if read error readNLines reads up to 'total' number of lines separated by \n.
func RemoveTempDir ¶ added in v0.1.5
func UnixToWinPathSeparator ¶ added in v1.3.0
func Unmarshal ¶ added in v1.1.0
Parses the JSON-encoded data and stores the result in the value pointed to by 'loadTarget'. filePath - Path to json file. loadTarget - Pointer to a struct
func WinToUnixPathSeparator ¶ added in v1.3.0
Types ¶
type Command ¶ added in v1.2.3
type Command struct { Executable string CmdName string CmdArgs []string Dir string StrWriter io.WriteCloser ErrWriter io.WriteCloser }
func NewCommand ¶ added in v1.2.3
func (*Command) GetErrWriter ¶ added in v1.2.3
func (config *Command) GetErrWriter() io.WriteCloser
func (*Command) GetStdWriter ¶ added in v1.2.3
func (config *Command) GetStdWriter() io.WriteCloser
func (*Command) RunWithOutput ¶ added in v1.2.3
type FileDetails ¶ added in v1.3.0
func GetFileDetails ¶ added in v1.3.0
func GetFileDetails(filePath string, includeChecksums bool) (details *FileDetails, err error)
type Log ¶
type Log interface { Debug(a ...interface{}) Info(a ...interface{}) Warn(a ...interface{}) Error(a ...interface{}) Output(a ...interface{}) }