utils

package
v0.0.0-...-89257ae Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFileContent

func CheckFileContent(path, content string) error

func CheckFileMatches

func CheckFileMatches(filepath string, regexes []*regexp.Regexp, skipRegexes []*regexp.Regexp, formats []string) bool

func CompilePatterns

func CompilePatterns(patterns []string) ([]*regexp.Regexp, error)

func ConfigureLogger

func ConfigureLogger(enableStdout bool, logFile string) error

func ConvertRelativePath

func ConvertRelativePath(path string) (string, error)

func CopyFile

func CopyFile(in, out string) error

func CreateDirectory

func CreateDirectory(path string) error

Create a directory from a given path recursively Skip if directory already exists

func CreateNamedFolder

func CreateNamedFolder(filePath string) (string, error)

func FileExists

func FileExists(path string) bool

func FindFiles

func FindFiles(params FindFilesParams) ([]string, error)

func FindOpenTcpPort

func FindOpenTcpPort() int

func GetCurrentHomeDirectory

func GetCurrentHomeDirectory() (string, error)

func GetLogger

func GetLogger(enableStdout bool, logFile string) (*zap.SugaredLogger, error)

func GetMagic

func GetMagic(filepath string) string

func ResolveLocalBinary

func ResolveLocalBinary(bin string) string

func ResolveLocalFile

func ResolveLocalFile(folder string, resolveOs bool) string

func SafeClose

func SafeClose(f *os.File)

func TimeToString

func TimeToString(t time.Time) string

func UniqueListOfStrings

func UniqueListOfStrings(s []string) []string

Types

type FindFilesParams

type FindFilesParams struct {
	Path string
	// Recurse			bool
	// Type		string
	PathPatterns []string
	SkipPatterns []string
	FileFormats  []string
}

type Logger

type Logger interface {
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Fatal(args ...interface{})
	Infof(format string, args ...interface{})
	Info(args ...interface{})
	Warnf(format string, args ...interface{})
	Debugf(format string, args ...interface{})
	Debug(args ...interface{})
}

Logger represent common interface for logging function

var Log Logger

Directories

Path Synopsis
Package guid provides a GUID type.
Package guid provides a GUID type.

Jump to

Keyboard shortcuts

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