myutils

package module
v0.0.0-...-182269b Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2016 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

myutils

My Go utils

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CPUProf

func CPUProf() func()

CPUProf runs the profiler and returns a function you need to defer

func Concat

func Concat(a string, b ...string) string

Concat some strings

func First

func First(args ...interface{}) interface{}

First returns first argument of a function return use it like

myutils.First(ab())

func Last

func Last(args ...interface{}) interface{}

Last returns first argument of a function return use it like

myutils.Last(ab())

func LogFatalError

func LogFatalError(err error)

LogFatalError it's a snippet for

if err != nil {
    log.Fatalf("Error: %s", err)
}

func Pick

func Pick(index int, args ...interface{}) interface{}

Pick returns picked argument of a function return use it like

myutils.Pick(1, ab())

func RequiredStrFatal

func RequiredStrFatal(name, str string)

RequiredStrFatal it's a snippet for

if str == "" {
    log.Fatalf("Error: %s is empty", name)
}

func Slice

func Slice(args ...interface{}) []interface{}

Slice returns arguments of a function return as a slice use it like

myutils.Slice(ab())[1]

func StrCrop

func StrCrop(str string, length int) string

StrCrop crops a string like you want in blog previews

Types

type SyncPrinter

type SyncPrinter struct {
	Queue chan string
	Close chan bool
}

SyncPrinter is a thread-safe printer. It will output given queue without

func NewSyncPrinter

func NewSyncPrinter() (*SyncPrinter, error)

NewSyncPrinter initialize a new SyncPrinter

func (*SyncPrinter) Run

func (printer *SyncPrinter) Run()

Run a SyncPrinter instance

Jump to

Keyboard shortcuts

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