util

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(items []string, target string) bool

Contains is used to check whether the target is in items

func ContainsEmpty

func ContainsEmpty(items ...string) bool

ContainsEmpty is used to check whether items contains empty string

func CopyDirectory

func CopyDirectory(src, dst string) error

CopyDirectory is used to copy directory If dst already exists, it will be merged

func CopyFile

func CopyFile(src, dst string) error

CopyFile is used to copy file from src to dst

func DeduplicateSliceStably added in v0.3.0

func DeduplicateSliceStably(items []string) []string

DeduplicateSliceStably is used to deduplicate slice items stably

func DumpYaml

func DumpYaml(cfg interface{})

DumpYaml is used to dump yaml into stdout

func GetBinaryFileName

func GetBinaryFileName(name string) string

GetBinaryFileName is used to get os based binary file name

func GetExitCode

func GetExitCode(err error) int

GetExitCode is used to parse exit code from cmd error

func GetFilesWithExt

func GetFilesWithExt(dir string, targetExt string) ([]string, error)

GetFilesWithExt is used to list files with a specific suffix expectExt should contain the prefix '.'

func GetFilesWithExtRecursively

func GetFilesWithExtRecursively(target string, targetExt string) ([]string, error)

GetFilesWithExtRecursively is used to recursively list files with a specific suffix expectExt should contain the prefix '.'

func GetMapKeys

func GetMapKeys(dict map[string]string) []string

GetMapKeys is used to get the keys of map

func IsDirExists

func IsDirExists(path string) (bool, error)

IsDirExists is used to check whether the dir exists

func IsFileExists

func IsFileExists(path string) (bool, error)

IsFileExists is used to check whether the file exists

func IsRegularVersion added in v0.4.1

func IsRegularVersion(s string) bool

IsRegularVersion is used to determine whether the version number is a regular version number Regular: va.b.c, and a, b, c are all numbers

func JoinGoPackageVersion

func JoinGoPackageVersion(path, version string) string

JoinGoPackageVersion is used to join go path and versions

func LoadConfig

func LoadConfig(filename string, pointer interface{}) error

LoadConfig read YAML-formatted config from filename into cfg.

func MatchPath

func MatchPath(pattern string, path string) (bool, error)

MatchPath is used to match path with specified pattern

func RenderPathWithEnv

func RenderPathWithEnv(path string, ext map[string]string) string

RenderPathWithEnv is used to render path with environment

func RenderWithEnv added in v0.4.0

func RenderWithEnv(s string, ext map[string]string) string

RenderWithEnv is used to render string with env

func SetToSlice

func SetToSlice(set map[string]struct{}) []string

SetToSlice is used to convert set<string> to slice<string>

func SortSemanticVersion added in v0.3.2

func SortSemanticVersion(items []string) ([]string, []string)

SortSemanticVersion is used to sort semantic version

func SplitGoPackageVersion

func SplitGoPackageVersion(pkg string) (path string, version string, ok bool)

SplitGoPackageVersion is used to split go package version

func SplitYAML

func SplitYAML(data []byte) ([][]byte, error)

SplitYAML is used to split yaml

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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