comtool

package module
v0.0.0-...-b0f62fa Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2014 License: MIT Imports: 11 Imported by: 4

README

comtool

golang common toolbox (utils)

http://godoc.org/github.com/codeskyblue/comtool

Good Repos
  • humanize: formatters for units to human friendly sizes go get github.cmm/dustin/go-humanize

  • goreq: Simple and sane HTTP request library for Go language. go get github.com/franela/goreq

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(name string) bool

Check if file exists

func GetFunctionName

func GetFunctionName(i interface{}) string

func GetLocalIPs

func GetLocalIPs() ([]*net.IP, error)

This returns the list of local ip addresses which other hosts can connect to (NOTE: Loopback ip is ignored).

func Go

func Go(f func() error) chan error

A helpful func

func HomeDir

func HomeDir() (home string, err error)

HomeDir returns path of '~'(in Linux) on Windows, it returns error when the variable does not exist.

func IsDir

func IsDir(name string) bool

func IsFile

func IsFile(name string) bool

func IsLocalhost

func IsLocalhost(host string) bool

Given a host string, return true if the host is an ip (v4/v6) localhost.

func ReadExitcode

func ReadExitcode(err error) int

func SelfDir

func SelfDir() string

Return program dir

func ShRun

func ShRun(name string, args ...string) error

func Template

func Template(s string, m map[string]string) string

func TrapSignal

func TrapSignal(f func(sig os.Signal), sigs ...os.Signal)

Types

This section is empty.

Jump to

Keyboard shortcuts

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