common

package
Version: v0.0.0-...-9e2cc1d Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

gopsutil is a port of psutil(http://pythonhosted.org/psutil/). This covers these architectures.

- linux (amd64, arm)
- freebsd (amd64)
- windows (amd64)

Index

Constants

This section is empty.

Variables

View Source
var NotImplementedError = errors.New("not implemented yet")

Functions

func ByteToString

func ByteToString(orig []byte) string

func GetEnv

func GetEnv(key string, dfault string, combineWith ...string) string

GetEnv retreives the environment variable key. If it does not exist it returns the default.

func HostProc

func HostProc(combineWith ...string) string

func HostSys

func HostSys(combineWith ...string) string

func IntToString

func IntToString(orig []int8) string

func PathExists

func PathExists(filename string) bool

func ReadLines

func ReadLines(filename string) ([]string, error)

ReadLines reads contents from a file and splits them by new lines. A convenience wrapper to ReadLinesOffsetN(filename, 0, -1).

func ReadLinesOffsetN

func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error)

ReadLines reads contents from file and splits them by new line. The offset tells at which line number to start. The count determines the number of lines to read (starting from offset):

n >= 0: at most n lines
n < 0: whole file

func StringsContains

func StringsContains(target []string, src string) bool

StringsContains checks the src in any string of the target string slice

func StringsHas

func StringsHas(target []string, src string) bool

StringsHas checks the target string slice containes src or not

Types

type FakeInvoke

type FakeInvoke struct {
	CommandExpectedDir string // CommandExpectedDir specifies dir which includes expected outputs.
	Suffix             string // Suffix species expected file name suffix such as "fail"
	Error              error  // If Error specfied, return the error.
}

func (FakeInvoke) Command

func (i FakeInvoke) Command(name string, arg ...string) ([]byte, error)

Command in FakeInvoke returns from expected file if exists.

type Invoke

type Invoke struct{}

func (Invoke) Command

func (i Invoke) Command(name string, arg ...string) ([]byte, error)

type Invoker

type Invoker interface {
	Command(string, ...string) ([]byte, error)
}

Source Files

Jump to

Keyboard shortcuts

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