utils

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: Apache-2.0 Imports: 11 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(name string) bool

Exists check if file exists on the filesystem

func Expand

func Expand(s string) ([]int, error)

Expand expands a string of the format 1,2,3-5 or * to the valid list of log levels

func Format

func Format(pattern string, values map[string]interface{}) string

Format accepts a string pattern of format "something {key}, something" and replaces all occurences of {<key>} from the values map.

func GetKeys

func GetKeys(m map[string]interface{}) []string

GetKeys returns the keys of map

func In

func In(l []int, x int) bool

In checks if x is in l

func InString

func InString(l []string, x string) bool

InString checks if x is in l

func LoadTomlFile

func LoadTomlFile(filename string, v interface{}) error

LoadTomlFile loads toml using "github.com/naoina/toml"

func SafeNormalize added in v1.2.0

func SafeNormalize(p string) string

SafeNormalize avoids relative path hacks by making sure the path does not have any ../ in it before normalization

func Update

func Update(dst map[string]interface{}, src map[string]interface{})

Update updates dst map from value in src

Types

type KernelOptions added in v1.2.0

type KernelOptions map[string][]string

func GetKernelOptions added in v1.2.0

func GetKernelOptions() KernelOptions

GetKernelOptions Get kernel cmdline arguments

func (KernelOptions) Get added in v1.2.0

func (k KernelOptions) Get(key string) ([]string, bool)

func (KernelOptions) GetLast added in v1.2.0

func (k KernelOptions) GetLast() map[string]interface{}

func (KernelOptions) Is added in v1.2.0

func (k KernelOptions) Is(key string) bool

func (KernelOptions) String added in v1.2.0

func (k KernelOptions) String(keys ...string) string

Jump to

Keyboard shortcuts

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