Documentation ¶
Index ¶
- Variables
- func AsyncMultiWriter(writers ...io.Writer) io.Writer
- func CalcChecksums(reader io.Reader, checksumType ...Algorithm) (map[Algorithm]string, error)
- func CalculateDependenciesList(typeRestriction TypeRestriction, executablePath, srcPath, moduleId string, ...) (dependenciesList []entities.Dependency, err error)
- func CleanOldDirs() error
- func CopyDir(fromPath, toPath string, includeDirs bool, excludeNames []string) error
- func CopyFile(dst, src string) error
- func CreateDirIfNotExist(path string) error
- func CreateExtractorPropsFile(extractorConfPath, buildInfoPath, buildName, buildNumber, project 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) (checksums *entities.Checksum, 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 GetNpmVersionAndExecPath(log Log) (*version.Version, string, error)
- func GetPartialsBuildDir(buildName, buildNumber, projectKey, buildsDirPath string) (string, error)
- func GetProjectRoot() (string, error)
- func IsDirExists(path string, followSymlink bool) (bool, error)
- func IsFileExists(path string, followSymlink bool) (bool, error)
- func IsFileSymlink(file os.FileInfo) bool
- func IsPathExists(path string) bool
- func IsPathSymlink(path string) bool
- func IsStringInSlice(string string, strings []string) bool
- func ListFiles(path string, includeDirs bool) ([]string, error)
- func MoveDir(fromPath, toPath string) error
- func MoveFile(sourcePath, destPath string) (err error)
- func NewDefaultLogger(logLevel LevelType) *defaultLogger
- func RemoveTempDir(dirPath string) error
- func RunGo(goArg []string, repoUrl string) error
- type Algorithm
- type Cmd
- type LevelType
- type Log
- type NullLog
- type PackageInfo
- type TypeRestriction
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 CalculateDependenciesList ¶ added in v1.0.0
func CalculateDependenciesList(typeRestriction TypeRestriction, executablePath, srcPath, moduleId string, npmArgs []string, traverseDependenciesFunc func(dependency *entities.Dependency) (bool, error), threads int, log Log) (dependenciesList []entities.Dependency, err error)
CalculateDependenciesList gets an npm project's dependencies. It sends each of them as a parameter to traverseDependenciesFunc and based on its return values, they will be returned from CalculateDependenciesList.
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, 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 GetNpmVersionAndExecPath ¶ added in v1.0.0
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 IsStringInSlice ¶ added in v1.0.0
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 RemoveTempDir ¶ added in v0.1.5
Types ¶
type Cmd ¶ added in v0.1.5
type Cmd struct { Go string Command []string CommandFlags []string Dir string StrWriter io.WriteCloser ErrWriter io.WriteCloser }
func (*Cmd) GetErrWriter ¶ added in v0.1.5
func (config *Cmd) GetErrWriter() io.WriteCloser
func (*Cmd) GetStdWriter ¶ added in v0.1.5
func (config *Cmd) GetStdWriter() io.WriteCloser
type Log ¶
type Log interface { Debug(a ...interface{}) Info(a ...interface{}) Warn(a ...interface{}) Error(a ...interface{}) Output(a ...interface{}) }
type PackageInfo ¶ added in v1.0.0
type PackageInfo struct { Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Scope string }
func ReadPackageInfo ¶ added in v1.0.0
func ReadPackageInfo(data []byte, npmVersion *version.Version) (*PackageInfo, error)
func ReadPackageInfoFromPackageJson ¶ added in v1.0.0
func ReadPackageInfoFromPackageJson(packageJsonDirectory string, npmVersion *version.Version) (*PackageInfo, error)
func (*PackageInfo) BuildInfoModuleId ¶ added in v1.0.0
func (pi *PackageInfo) BuildInfoModuleId() string
func (*PackageInfo) FullName ¶ added in v1.0.0
func (pi *PackageInfo) FullName() string
func (*PackageInfo) GetDeployPath ¶ added in v1.0.0
func (pi *PackageInfo) GetDeployPath() string
type TypeRestriction ¶ added in v1.0.0
type TypeRestriction int
const ( DefaultRestriction TypeRestriction = iota All DevOnly ProdOnly )