util

package
v0.0.0-...-03d6fc4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: BSD-3-Clause Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB float64 = 1 << (10 * iota)
	MB
	GB
	TB
	PB

	PROJECT_CHROMIUM    = "chromium"
	BUG_DEFAULT_PROJECT = PROJECT_CHROMIUM
	BUGS_PATTERN        = "(?m)^(?:BUG=|Bug:)(.+)$"

	SECONDS_TO_MILLIS = int64(time.Second / time.Millisecond)
	MILLIS_TO_NANOS   = int64(time.Millisecond / time.Nanosecond)
	MICROS_TO_NANOS   = int64(time.Microsecond / time.Nanosecond)

	// time.RFC3339Nano only uses as many sub-second digits are required to
	// represent the time, which makes it unsuitable for sorting. This
	// format ensures that all 9 nanosecond digits are used, padding with
	// zeroes if necessary.
	RFC3339NanoZeroPad = sklog.RFC3339NanoZeroPad

	// SAFE_TIMESTAMP_FORMAT is time format which is similar to
	// RFC3339NanoZeroPad, but with most of the punctuation omitted. This
	// timestamp can only be used to format and parse times in UTC.
	SAFE_TIMESTAMP_FORMAT = "20060102T150405.000000000Z"
)

Variables

View Source
var (
	BUGS_REGEX = regexp.MustCompile(BUGS_PATTERN)

	TimeZero     = time.Time{}.UTC()
	TimeUnixZero = time.Unix(0, 0).UTC()
)

Functions

func AbsInt

func AbsInt(v int) int

AbsInt returns the absolute value of v.

func AddParamSetToParamSet

func AddParamSetToParamSet(a map[string][]string, b map[string][]string) map[string][]string

func AddParams

func AddParams(a map[string]string, b ...map[string]string) map[string]string

AddParams adds the second instance of map[string]string to the first and returns the first map.

func AddParamsToParamSet

func AddParamsToParamSet(a map[string][]string, b map[string]string) map[string][]string

func AnyMatch

func AnyMatch(re []*regexp.Regexp, s string) bool

AnyMatch returns true iff the given string matches any regexp in the slice.

func AtMost

func AtMost(a []string, n int) []string

AtMost returns a subslice of at most the first n members of a.

func BugsFromCommitMsg

func BugsFromCommitMsg(msg string) map[string][]string

BugsFromCommitMsg parses BUG= tags from a commit message and returns them.

func ChunkIter

func ChunkIter(length, chunkSize int, fn func(int, int) error) error

ChunkIter iterates over a slice in chunks of smaller slices.

func ChunkIterInt

func ChunkIterInt(s []int, chunkSize int, fn func([]int) error) error

ChunkIterInt iterates over a slice of ints in chunks of smaller slices.

func Close

func Close(c io.Closer)

Close wraps an io.Closer and logs an error if one is returned.

func ContainsAny

func ContainsAny(s string, a []string) bool

ContainsAny returns true if |s| contains any element of |a|.

func ContainsAnyMap

func ContainsAnyMap(parent map[string]string, children ...map[string]string) bool

ContainsAnyMap checks to see if any of the children maps are contained in the parent map.

func ContainsAnyMapInSliceValues

func ContainsAnyMapInSliceValues(parent map[string][]string, children ...map[string]string) bool

ContainsAnyMapInSliceValues checks to see if any of the children maps are contained in the parent map.

func ContainsMap

func ContainsMap(parent, child map[string]string) bool

ContainsMap checks if child map is contained within the parent map

func ContainsMapInSliceValues

func ContainsMapInSliceValues(parent map[string][]string, child map[string]string) bool

ContainsMapInSliceValues checks if child map is contained within the parent map.

func CookieDomainMatch

func CookieDomainMatch(domainA, domainB string) bool

CookieDomainMatch returns True if domainA domain-matches domainB, according to RFC 2965. domainA and domainB may only be host domain names. IP addresses are currently not supported.

RFC 2965, section 1:

Host names can be specified either as an IP address or a HDN string.
Sometimes we compare one host name with another.  (Such comparisons SHALL
be case-insensitive.)  Host A's name domain-matches host B's if
* their host name strings string-compare equal; or
* A is a HDN string and has the form NB, where N is a non-empty
  name string, B has the form .B', and B' is a HDN string.  (So,
  x.y.com domain-matches .Y.com but not Y.com.)
Note that domain-match is not a commutative operation: a.b.c.com
domain-matches .c.com, but not the reverse.

func CopyStringMap

func CopyStringMap(m map[string]string) map[string]string

CopyStringMap returns a copy of the provided map[string]string such that reflect.DeepEqual returns true for the given map and the returned map. In particular, preserves nil input.

func CopyStringSlice

func CopyStringSlice(s []string) []string

CopyStringSlice copies the given []string such that reflect.DeepEqual returns true for the given slice and the returned slice. In particular, preserves nil slice input.

func Float64StableSum

func Float64StableSum(s []float64) float64

Float64StableSum returns the sum of the elements of the given []float64 in a relatively stable manner.

func FromDos

func FromDos(s string) string

FromDos performs like the "fromdos" tool on Linux: it converts line endings in the given string from Dos to Unix format.

func GenerateID

func GenerateID() (string, error)

Generate a 16-byte random ID.

func GetFormattedByteSize

func GetFormattedByteSize(b float64) string

GetFormattedByteSize returns a formatted pretty string representation of the provided byte size. Eg: Input of 1024 would return "1.00KB".

func GetStackTrace

func GetStackTrace() string

GetStackTrace returns the stacktrace including GetStackTrace itself.

func In

func In(s string, a []string) bool

In returns true if |s| is *in* |a| slice.

func Index

func Index(s string, a []string) int

Index returns the index of |s| *in* |a| slice, and -1 if not found.

func InsertString

func InsertString(strs []string, idx int, s string) []string

InsertString inserts the given string into the slice at the given index.

func InsertStringSorted

func InsertStringSorted(strs []string, s string) []string

InsertStringSorted inserts the given string into the sorted slice of strings if it does not already exist. Maintains sorted order.

func Int64Equal

func Int64Equal(a, b []int64) bool

Int64Equal returns true if the int64 slices are equal.

func IntersectIntSets

func IntersectIntSets(sets []map[int]bool, minIdx int) map[int]bool

IntersectIntSets calculates the intersection of a list of integer sets.

func IsDirEmpty

func IsDirEmpty(dir string) (bool, error)

IsDirEmpty checks to see if the specified directory has any contents.

func IsNil

func IsNil(i interface{}) bool

Returns true if i is nil or is an interface containing a nil or invalid value.

func IterTimeChunks

func IterTimeChunks(start, end time.Time, chunkSize time.Duration, fn func(time.Time, time.Time) error) error

IterTimeChunks calls the given function for each time chunk of the given duration within the given time range.

func KeysOfIntSet

func KeysOfIntSet(set map[int]bool) []int

KeysOfIntSet returns the keys of a set of strings represented by the keys of a map.

func KeysOfParamSet

func KeysOfParamSet(set map[string][]string) []string

KeysOfParamSet returns the keys of a param set.

func LogErr

func LogErr(err error)

LogErr logs err if it's not nil. This is intended to be used for calls where generally a returned error can be ignored.

func MD5FromReader

func MD5FromReader(r io.Reader, w io.Writer) ([]byte, error)

MD5FromReader returns the MD5 hash of the content in the provided reader. If the writer w is not nil it will also write the content of the reader to w.

func MD5SSlice

func MD5SSlice(val []string) (string, error)

MD5SSlice returns the MD5 hash of the provided []string.

func MD5Sum

func MD5Sum(val interface{}) (string, error)

MD5Sum returns the MD5 hash of the given value. It supports anything that can be encoded via bencode (https://en.wikipedia.org/wiki/Bencode).

func MapsEqual

func MapsEqual(a, b map[string]string) bool

MapsEqual checks if the two maps are equal.

func MaxInt

func MaxInt(intList ...int) int

MaxInt returns the largest integer of the arguments provided.

func MaxInt32

func MaxInt32(a, b int32) int32

MaxInt32 returns largest integer of a and b.

func MaxInt64

func MaxInt64(a, b int64) int64

MaxInt64 returns largest integer of a and b.

func MaybeReadGobFile

func MaybeReadGobFile(file string, data interface{}) error

MaybeReadGobFile reads data from the given file into the given data structure. If the file does not exist, no error is returned and no data is written.

func MinInt

func MinInt(a, b int) int

MinInt returns the smaller integer of a and b.

func MinInt32

func MinInt32(a, b int32) int32

MinInt32 returns the smaller integer of a and b.

func MinInt64

func MinInt64(a, b int64) int64

MinInt64 returns the smaller integer of a and b.

func Mkdir

func Mkdir(name string, perm os.FileMode)

Mkdir creates the specified path and logs an error if one is returned.

func MkdirAll

func MkdirAll(name string, perm os.FileMode)

MkdirAll creates the specified path and logs an error if one is returned.

func NewThreadSafeWriter

func NewThreadSafeWriter(w io.Writer) io.Writer

NewThreadSafeWriter returns a ThreadSafeWriter which wraps the given Writer.

func ParseIntSet

func ParseIntSet(expr string) ([]int, error)

ParseIntSet parses a string expression like "5", "3-8", or "3,4,9" into a slice of integers: [5], [3, 4, 5, 6, 7, 8], [3, 4, 9].

func ParseTimeNs

func ParseTimeNs(t string) (time.Time, error)

func Permute

func Permute(ints []int) [][]int

Permute returns all permutations of the given slice of ints. Duplicates in the input slice will result in duplicate permutations returned.

func PermuteStrings

func PermuteStrings(strs []string) [][]string

PermuteStrings returns all permutations of the given slice of strings. Duplicates in the input slice will result in duplicate permutations returned.

func RandomName

func RandomName() string

RandomName returns a randomly-generated name of the form, "adjective-noun-number", using the default generator from the math/rand package.

func RandomNameR

func RandomNameR(r *mathrand.Rand) string

RandomNameR returns a randomly-generated name of the form, "adjective-noun-number", using the given math/rand.Rand instance.

func ReadGobFile

func ReadGobFile(file string, data interface{}) error

ReadGobFile reads data from the given file into the given data structure.

func Remove

func Remove(name string)

Remove removes the specified file and logs an error if one is returned.

func RemoveAll

func RemoveAll(path string)

RemoveAll removes the specified path and logs an error if one is returned.

func Rename

func Rename(oldpath, newpath string)

Rename renames the specified file and logs an error if one is returned.

func Repeat

func Repeat(interval time.Duration, stopCh <-chan bool, fn func())

Repeat calls the provided function 'fn' immediately and then in intervals defined by 'interval'. If anything is sent on the provided stop channel, the iteration stops.

func RepeatCtx

func RepeatCtx(interval time.Duration, ctx context.Context, fn func())

RepeatCtx calls the provided function 'fn' immediately and then in intervals defined by 'interval'. If the given context is canceled, the iteration stops.

func RepeatJoin

func RepeatJoin(str, sep string, n int) string

RepeatJoin repeats a given string N times with the given separator between each instance.

func Reverse

func Reverse(s []string) []string

Reverse returns the given slice of strings in reverse order.

func Round

func Round(v float64) float64

Round rounds the given float64 to the nearest whole integer.

func RoundUpToPowerOf2

func RoundUpToPowerOf2(i int32) int32

RoundUpToPowerOf2 rounds the given int up to the nearest power of 2.

func SSliceCmp

func SSliceCmp(a, b []string) int

SSliceCmp compares two string slices by comparing each element in order. Returns -1 if the first slice is "less" than the second, 0 if they are equal, and 1 if the first slice is "greater" than the second.

func SSliceEqual

func SSliceEqual(a, b []string) bool

func SafeAtoi

func SafeAtoi(n string) int

SafeParseInt parses a string that is known to contain digits into an int. If the number is larger than MAX_INT, 0 will be returned after logging an error.

func SignInt

func SignInt(v int) int

SignInt returns -1, 1 or 0 depending on the sign of v.

func StringToCodeName

func StringToCodeName(s string) string

StringToCodeName returns a name generated from the source string. The string is hashed and used as the seed for a random number generator.

func TimeIsZero

func TimeIsZero(t time.Time) bool

TimeIsZero returns true if the time.Time is a zero-value or corresponds to a zero Unix timestamp.

func TimeStamp

func TimeStamp(targetUnit time.Duration) int64

Returns the current time in the units defined by the given target unit. e.g. TimeStamp(time.Millisecond) will return the time in Milliseconds. The result is always rounded down to the lowest integer from the representation in nano seconds.

func TimeStampMs

func TimeStampMs() int64

Returns the current time in milliseconds since the epoch.

func TimeToUnixFloat

func TimeToUnixFloat(t time.Time) float64

TimeToUnixFloat takes a time.Time and returns a float64 representing a Unix timestamp.

func ToDos

func ToDos(s string) string

ToDos performs like the "todos" tool on Linux: it converts line endings in the given string from Unix to Dos format.

func Trunc

func Trunc(s string, n int) string

Trunc returns s truncated to n+3 chars.

If len(s) < n then the string is unchanged.

func Truncate

func Truncate(s string, length int) string

Truncate the given string to the given length. If the string was shortened, change the last three characters to ellipses, unless the specified length is 3 or less.

func UnZip

func UnZip(dest, src string) error

UnZip unzips the file specified in src into the 'dest' directory. Note: * The parent directory will be created using the mode of the first directory in the zip. * src could be partially populated if an error is returned.

func UnixFloatToTime

func UnixFloatToTime(t float64) time.Time

UnixFloatToTime takes a float64 representing a Unix timestamp in seconds and returns a time.Time. Rounds to milliseconds.

func UnixMillisToTime

func UnixMillisToTime(t int64) time.Time

UnixMillisToTime takes an int64 representing a Unix timestamp in milliseconds and returns a time.Time.

func ValidateCommit

func ValidateCommit(hash string) bool

ValidateCommit returns true iff the given commit hash looks valid. Does not perform any check as to whether the commit means anything in a particular repository.

func WithBufferedWriter

func WithBufferedWriter(w io.Writer, fn func(w io.Writer) error) (err error)

WithBufferedWriter is a helper for wrapping an io.Writer with a bufio.Writer.

func WithGzipWriter

func WithGzipWriter(w io.Writer, fn func(w io.Writer) error) (err error)

WithGzipWriter is a helper for wrapping an io.Writer with a gzip.Writer.

func WithReadFile

func WithReadFile(file string, fn func(f io.Reader) error) error

WithReadFile opens the given file for reading and runs the given function.

func WithWriteFile

func WithWriteFile(file string, writeFn func(io.Writer) error) error

WithWriteFile provides an interface for writing to a backing file using a temporary intermediate file for more atomicity in case a long-running write gets interrupted.

func WriteGobFile

func WriteGobFile(file string, data interface{}) error

WriteGobFile writes the given data to the given file, using gob encoding.

func ZipIt

func ZipIt(target, source string) error

ZipIt zips the specified directory into the target file. Note: source must be an absolute path. Also, this is untested with symlinks.

Types

type CondMonitor

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

CondMonitor implements a monitor that limits the number of threads per int64-id that can concurrently enter a critical section. This could be used like this:

...
mon := NewCondInt64Monitor(5)
...
defer mon.Enter(id).Release()
...

This allows 5 threads for each value of id to enter the critical section which starts after the call to 'Enter' and ends when 'Release' is called.

func NewCondMonitor

func NewCondMonitor(nConcurrent int) *CondMonitor

NewCondMonitor creates a new monitor with the given number of concurrent threads that can enter the critical section for every int64 value provided to the 'Enter' call.

func (*CondMonitor) Enter

func (m *CondMonitor) Enter(id int64) MonitorRelease

Enter marks the start of a critical section. It limits the number of threads

type GobDecoder

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

GobDecoder decodes bytes into structs via GOB decoding. Not safe for concurrent use.

Here's a template for writing a type-specific decoder:

FooDecoder decodes bytes into Foos via GOB decoding. Not safe for concurrent use.

type FooDecoder struct {
	*util.GobDecoder
}

// NewFooDecoder returns a FooDecoder instance.

func NewFooDecoder() *FooDecoder {
	return &FooDecoder{
		GobDecoder: util.NewGobDecoder(func() interface{} {
			return &Foo{}
		}, func(ch <-chan interface{}) interface{} {
			items := []*Foo{}
			for item := range ch {
				items = append(items, item.(*Foo))
			}
			return items
		}),
	}
}

// Result returns all decoded Foos provided to Process (in arbitrary order), or // any error encountered.

func (d *FooDecoder) Result() ([]*Foo, error) {
	res, err := d.GobDecoder.Result()
	if err != nil {
		return nil, err
	}
	return res.([]*Foo), nil
}

func NewGobDecoder

func NewGobDecoder(newItem func() interface{}, collect func(<-chan interface{}) interface{}) *GobDecoder

NewGobDecoder returns a GobDecoder instance. The first argument is a goroutine-safe function which returns a zero-valued instance of the type being decoded, eg.

func() interface{} {
	return &MyType{}
}

The second argument is a function which collects decoded instances of that type from a channel and returns a slice, eg.

func(ch <-chan interface{}) interface{} {
	items := []*MyType{}
	for item := range ch {
		items = append(items, item.(*MyType))
	}
	return items
}

func (*GobDecoder) Process

func (d *GobDecoder) Process(b []byte) bool

Process decodes the byte slice and includes it in Result() (in arbitrary order). Returns false if Result is certain to return an error. Caller must ensure b does not change until after Result() returns.

func (*GobDecoder) Result

func (d *GobDecoder) Result() (interface{}, error)

Result returns all decoded items provided to Process (in arbitrary order), or any error encountered.

type GobEncoder

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

GobEncoder encodes structs into bytes via GOB encoding. Not safe for concurrent use.

Here's a template for writing a type-specific encoder:

// FooEncoder encodes Foos into bytes via GOB encoding. Not safe for // concurrent use.

type FooEncoder {
	util.GobEncoder
}

// Next returns one of the Foox provided to Process (in arbitrary order) and // its serialized bytes. If any items remain, returns the item, the // serialized bytes, nil. If all items have been returned, returns nil, nil, // nil. If an error is encountered, returns nil, nil, error.

func (e *FooEncoder) Next() (*Foo, []byte, error) {
	item, serialized, err := e.GobEncoder.Next()
	if err != nil {
		return nil, nil, err
	} else if item == nil {
		return nil, nil, nil
	}
	return item.(*Foo), serialized, nil
}

func (*GobEncoder) Next

func (e *GobEncoder) Next() (interface{}, []byte, error)

Next returns one of the items provided to Process (in arbitrary order) and its serialized bytes. If any items remain, returns the item, the serialized bytes, nil. If all items have been returned, returns nil, nil, nil. If an error is encountered, returns nil, nil, error.

func (*GobEncoder) Process

func (e *GobEncoder) Process(item interface{}) bool

Process encodes the item into a byte slice that will be returned from Next() (in arbitrary order). Returns false if Next is certain to return an error. Caller must ensure item does not change until after the first call to Next(). May not be called after calling Next().

type Int64Slice

type Int64Slice []int64

func (Int64Slice) Len

func (p Int64Slice) Len() int

func (Int64Slice) Less

func (p Int64Slice) Less(i, j int) bool

func (Int64Slice) Swap

func (p Int64Slice) Swap(i, j int)

type LRUCache

type LRUCache interface {
	// Add adds a key-value pair to the cache.
	Add(key, value interface{}) bool

	// Get returns a key value for the given cache. If ok is true
	// the fetch was succesfull.
	Get(key interface{}) (value interface{}, ok bool)

	// Len returns the current size of the cache.
	Len() int

	// Remove removes a key value pair from the cache.
	Remove(key interface{})

	// Keys returns all the keys in the LRUCache.
	Keys() []interface{}
}

Generic LRUCache interface.

type LRUCodec

type LRUCodec interface {
	// Encode serializes the given value to a byte array (inverse of Decode).
	Encode(interface{}) ([]byte, error)

	// Decode deserializes the byte array to an instance of the type that
	// was passed to Encode in a prior call.
	Decode([]byte) (interface{}, error)
}

LRUCodec converts serializes/deserializes an instance of a type to/from byte arrays. Encode and Decode have to be the inverse of each other.

func JSONCodec

func JSONCodec(instance interface{}) LRUCodec

JSONCodec implements the LRUCodec interface by serializing and deserializing instances of the underlying type of 'instance'. Generally it's assumed that 'instance' is a struct, a pointer to a struct, a slice or a map.

type MemLRUCache

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

func NewMemLRUCache

func NewMemLRUCache(maxEntries int) *MemLRUCache

func (*MemLRUCache) Add

func (m *MemLRUCache) Add(key, value interface{}) bool

func (*MemLRUCache) Get

func (m *MemLRUCache) Get(key interface{}) (value interface{}, ok bool)

func (*MemLRUCache) Keys

func (m *MemLRUCache) Keys() []interface{}

func (*MemLRUCache) Len

func (m *MemLRUCache) Len() int

func (*MemLRUCache) Remove

func (m *MemLRUCache) Remove(key interface{})

type MonitorRelease

type MonitorRelease func()

MonitorRelease is returned by the Enter call.

func (MonitorRelease) Release

func (m MonitorRelease) Release()

Release is called to identify the end of the critical section.

type MultiWriter

type MultiWriter []io.Writer

MultiWriter is like io.MultiWriter but attempts to write to all of the given io.Writers, even if writing to one fails.

func (MultiWriter) Write

func (mw MultiWriter) Write(b []byte) (int, error)

See documentation for io.Writer. Uses a multierror.Error to summarize any and all errors returned by each of the io.Writers.

type NamedErrGroup

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

NamedErrGroup is like errgroup.Group, except each function in the group gets a name. It waits for all goroutines to finish and reports all errors by name.

func NewNamedErrGroup

func NewNamedErrGroup() *NamedErrGroup

NewNamedErrGroup returns a NamedErrGroup instance.

func (*NamedErrGroup) Go

func (g *NamedErrGroup) Go(name string, fn func() error)

Go runs the given function in a goroutine.

func (*NamedErrGroup) Wait

func (g *NamedErrGroup) Wait() error

Wait waits for all of the goroutines to finish and reports any errors.

type StringSet

type StringSet map[string]bool

StringSet is a set of strings, represented by the keys of a map.

func NewStringSet

func NewStringSet(lists ...[]string) StringSet

NewStringSet returns the given list(s) of strings as a StringSet.

func (StringSet) AddLists

func (s StringSet) AddLists(lists ...[]string) StringSet

AddLists adds lists of strings to the StringSet and returns the receiving StringSet.

func (StringSet) Complement

func (s StringSet) Complement(other StringSet) StringSet

Complement returns a new StringSet containing all the original strings that are not in StringSet other

func (StringSet) Copy

func (s StringSet) Copy() StringSet

Copy returns a copy of the StringSet such that reflect.DeepEqual returns true for the original and copy. In particular, preserves nil input.

func (StringSet) Equals

func (s StringSet) Equals(other StringSet) bool

func (StringSet) Intersect

func (s StringSet) Intersect(other StringSet) StringSet

Intersect returns a new StringSet containing all the original strings that are also in StringSet other

func (StringSet) Keys

func (s StringSet) Keys() []string

Keys returns the keys of a StringSet

func (StringSet) String

func (s StringSet) String() string

String returns a comma seperated list of the values of the set.

func (StringSet) Union

func (s StringSet) Union(other StringSet) StringSet

Union returns a new StringSet containing all the original strings and all the strings in StringSet other

type TempRepo

type TempRepo struct {
	// Root of unzipped Git repo.
	Dir string
}

TempRepo is used to setup and teardown a temporary repo for unit testing.

func NewTempRepo

func NewTempRepo() *TempRepo

NewTempRepo assumes the repo is called testrepo.zip and is in a directory called testdata under the directory of the unit test that is calling it.

The directory that was created is stored in TempRepo Path.

func NewTempRepoFrom

func NewTempRepoFrom(zipfile string) *TempRepo

NewTempRepoFrom returns a TempRepo instance based on the contents of the given zip file path. Unzips to a temporary directory which is stored in TempRepo.Dir.

func (*TempRepo) Cleanup

func (t *TempRepo) Cleanup()

Cleanup cleans up the temporary repo.

type ThreadSafeWriter

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

ThreadSafeWriter wraps an io.Writer and provides thread safety.

func (*ThreadSafeWriter) Write

func (w *ThreadSafeWriter) Write(b []byte) (int, error)

See documentation for io.Writer.

type Validator

type Validator interface {
	Validate() error
}

Validator is an interface which has a Validate() method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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