util

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2016 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFatal

func CheckFatal(t *testing.T, err error)

CheckFatal raises a fatal error if error is not nil

func DurationStr

func DurationStr(secs int) string

DurationStr returns seconds as a duration string, i.e. 9h10m30s

func FormatDuration

func FormatDuration(secs int) string

FormatDuration converts seconds into a duration string

func LeftPad2Len

func LeftPad2Len(s string, padStr string, overallLen int) string

LeftPad2Len https://github.com/DaddyOh/golang-samples/blob/master/pad.go

func Map

func Map(vs []string, f func(string) string) []string

Map applys a func to a string array

func Percent

func Percent(val, total int) float64

Percent returns a values percent of the total

func RightPad2Len

func RightPad2Len(s string, padStr string, overallLen int) string

RightPad2Len https://github.com/DaddyOh/golang-samples/blob/master/pad.go

func StringInSlice

func StringInSlice(list []string, a string) bool

StringInSlice https://github.com/DaddyOh/golang-samples/blob/master/pad.go

Types

type ByInt64

type ByInt64 []int64

ByInt64 list of type int64

func (ByInt64) Len

func (e ByInt64) Len() int

func (ByInt64) Less

func (e ByInt64) Less(i, j int) bool

func (ByInt64) Swap

func (e ByInt64) Swap(i, j int)

type TestRepo

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

TestRepo represents a test git repo used in testing

func NewTestRepo

func NewTestRepo(t *testing.T, bare bool) TestRepo

NewTestRepo creates a new instance of TestRepo

func (TestRepo) Commit

func (t TestRepo) Commit(treeID *git.Oid) *git.Oid

Commit commits staged files

func (TestRepo) PathIn

func (t TestRepo) PathIn(name string) string

PathIn returns full path of file within repo

func (TestRepo) Remove

func (t TestRepo) Remove()

Remove deletes temp directories, files and git repo

func (TestRepo) SaveFile

func (t TestRepo) SaveFile(filename, subdir, content string)

SaveFile creates a file within the git repo project

func (TestRepo) Seed

func (t TestRepo) Seed()

Seed creates test data for the git repo

func (TestRepo) Stage

func (t TestRepo) Stage(files ...string) *git.Oid

Stage adds files to staging for git repo

Source Files

  • sort.go
  • string.go
  • test.go

Jump to

Keyboard shortcuts

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