utils

package
v0.0.0-...-6d8d8d4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(input []interface{}, value interface{}) (bool, error)

Contains check if a interface in a interface slice.

func CopyFile

func CopyFile(dst, src string, perm os.FileMode) error

CopyFile copys src file to dest file

func ExecCommand

func ExecCommand(name string, args ...string) error

ExecCommand is a wrapper of exec Command

func IfThenElse

func IfThenElse(condition bool, a interface{}, b interface{}) interface{}

IfThenElse evaluates a condition, if true returns the first parameter, Otherwise the second.

func IsDirEmpty

func IsDirEmpty(dir string) (bool, error)

IsDirEmpty is to check if a directory is empty

func MoveDir

func MoveDir(srcDir, dstDir string) error

MoveDir moves all files in srcDir to dstDir

func RemoveDuplicateElement

func RemoveDuplicateElement(addrs []string) []string

RemoveDuplicateElement delete duplicate item from slice

func SliceTrimSpace

func SliceTrimSpace(input []string) []string

SliceTrimSpace delete empty item, like " ", "\t", "\n" from slice

func StringInSlice

func StringInSlice(input []string, str string) bool

StringInSlice checks if a string in the slice.

func StringSliceEqual

func StringSliceEqual(s1, s2 []string) bool

StringSliceEqual compare two string slice, ignore the order. we also should consider if there has duplicate items in slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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