util

package
v0.0.0-...-718ecc9 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HostByteOrder = binary.LittleEndian

Functions

func Distance

func Distance(p1, p2 entities.Position) float64

func GetLogger

func GetLogger(forComponent string) (*log.Logger, error)

func GracefulStop

func GracefulStop(cmd *exec.Cmd, ctx context.Context) error

Attemps to cleanly shutdown the process

func IsRunning

func IsRunning(name string) (bool, error)

Returns if a process matching name is running

func KillAll

func KillAll(pid int32) error

func LogProcess

func LogProcess(cmd *exec.Cmd, log *log.Logger) error

func LogReader

func LogReader(reader io.Reader, log *log.Logger)

func NewTempLogger

func NewTempLogger() (*os.File, error)

func PackedStructSize

func PackedStructSize(theStruct interface{}) (int, error)

returns the size of the packed struct. It is an error to call this function on anything that is not a struct (or a pointer thereto) with primitive-only members.

func PackedStructToBytes

func PackedStructToBytes(bytes []byte, theStruct interface{}) error

Converts theStruct into an array of bytes. It is an error to call this function on anything that is not a struct (or a pointer thereto) with primitive-only members. len(bytes) must be sufficient to store every member of theStruct.

func ReadPackedStruct

func ReadPackedStruct(bytes []byte, place interface{}) error

Reads a packed struct. place must point to a struct with primitive members only

func WaitWithContext

func WaitWithContext(ctx context.Context, cmd *exec.Cmd) error

Waits for cmd to exit using the supplied context

Types

This section is empty.

Jump to

Keyboard shortcuts

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