util

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Quiet = false
)

Functions

func CacheDir added in v0.1.11

func CacheDir() string

func DefaultCacheDir added in v0.1.11

func DefaultCacheDir() string

func DeleteNil

func DeleteNil(errs []error) (new []error)

DeleteNil deletes nil in errs

func DeleteRecordNotFound

func DeleteRecordNotFound(errs []error) (new []error)

DeleteRecordNotFound deletes gorm.ErrRecordNotFound in errs

func DiffRedhat

func DiffRedhat(old, new *models.RedhatCVE, config config.RedhatWatchCve) (body string)

func Exec added in v0.1.11

func Exec(command string, args []string) (string, error)

func Exists added in v0.1.11

func Exists(path string) (bool, error)

func FetchConcurrently

func FetchConcurrently(urls []string, concurrency, wait int) (responses [][]byte, err error)

FetchConcurrently fetches concurrently

func FetchURL

func FetchURL(url, apikey string) ([]byte, error)

FetchURL returns HTTP response body

func FileWalk added in v0.1.11

func FileWalk(root string, targetFiles map[string]struct{}, walkFn func(r io.Reader, path string) error) error

func FilterTargets added in v0.1.11

func FilterTargets(prefixPath string, targets map[string]struct{}) (map[string]struct{}, error)

func GenWorkers

func GenWorkers(num, wait int) chan<- func()

GenWorkers generate workers

func GetDefaultLogDir

func GetDefaultLogDir() string

GetDefaultLogDir returns default log directory

func IsCommandAvailable added in v0.1.11

func IsCommandAvailable(name string) bool

func Major

func Major(osVer string) (majorVersion string)

Major returns major version

func SetCacheDir added in v0.1.11

func SetCacheDir(dir string)

func SetLogger

func SetLogger(logDir string, debug, logJSON bool)

SetLogger set logger

func StringInSlice added in v0.1.11

func StringInSlice(a string, list []string) bool

func TrimSpaceNewline

func TrimSpaceNewline(str string) string

TrimSpaceNewline deletes space character and newline character(CR/LF)

Types

type ProgressBar added in v0.1.11

type ProgressBar struct {
	// contains filtered or unexported fields
}

func PbStartNew added in v0.1.11

func PbStartNew(total int) *ProgressBar

func (*ProgressBar) Finish added in v0.1.11

func (p *ProgressBar) Finish()

func (*ProgressBar) Increment added in v0.1.11

func (p *ProgressBar) Increment()

type Spinner added in v0.1.11

type Spinner struct {
	// contains filtered or unexported fields
}

func NewSpinner added in v0.1.11

func NewSpinner(suffix string) *Spinner

func (*Spinner) Start added in v0.1.11

func (s *Spinner) Start()

func (*Spinner) Stop added in v0.1.11

func (s *Spinner) Stop()

Jump to

Keyboard shortcuts

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