utils

package
v0.0.0-...-be0919c Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2018 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallOnce

func CallOnce(f func()) func()

CallOnce function decorator returns new function which can be called only once and is thread safe

func HardKiller

func HardKiller(kill Killer) func()

HardKiller invokes provided kill method and forces process to exit

func SoftKiller

func SoftKiller(kill Killer) func()

SoftKiller invokes killer and gives a chance for process to cleanup itself

func SplitCommand

func SplitCommand(command string, commandArguments string) *exec.Cmd

SplitCommand parses command arguments from string and returns command with split arguments

Types

type Killer

type Killer func() error

Killer kills some resource and performs cleanup

type SettableClock

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

SettableClock allows settings and getting time, which is convenient for testing

func (*SettableClock) AddTime

func (clock *SettableClock) AddTime(duration time.Duration)

AddTime adds given duration to current clock time

func (*SettableClock) GetTime

func (clock *SettableClock) GetTime() time.Time

GetTime returns set time

func (*SettableClock) SetTime

func (clock *SettableClock) SetTime(time time.Time)

SetTime sets time to be returned from GetTime

Jump to

Keyboard shortcuts

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