utils

package
v0.0.0-...-378edf0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheDir

func CacheDir() string

func DeleteNil

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

DeleteNil deletes nil in errs

func Exec

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

func Exists

func Exists(path string) (bool, error)

func FetchConcurrently

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

FetchConcurrently fetches concurrently

func FetchURL

func FetchURL(url, apikey string, retry int) (res []byte, err error)

FetchURL returns HTTP response body with retry

func GenWorkers

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

GenWorkers generate workders

func GetLastUpdatedDate

func GetLastUpdatedDate(dist string) (time.Time, error)

func IsCommandAvailable

func IsCommandAvailable(name string) bool

func LookupEnv

func LookupEnv(key, defaultValue string) string

func Major

func Major(osVer string) (majorVersion string)

Major returns major version

func RandInt

func RandInt() int

func SaveCVEPerYear

func SaveCVEPerYear(dirName string, cveID string, data interface{}) error

func SetLastUpdatedDate

func SetLastUpdatedDate(dist string, lastUpdatedDate time.Time) error

func TrimSpaceNewline

func TrimSpaceNewline(str string) string

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

func VulnListDir

func VulnListDir() string

func Write

func Write(filePath string, data interface{}) error

func WriteJSON

func WriteJSON(fs afero.Fs, dir, fileName string, data interface{}) error

Types

type LastUpdated

type LastUpdated map[string]time.Time

Jump to

Keyboard shortcuts

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