a41f938cec
As we have seen, dependencies version can prevent the build. We should user lock versions on dependencies that we know work: * Packages are vendored * Add Godep support * Added addtional install step in readme * Fix travis build error
14 lignes
262 o
Go
14 lignes
262 o
Go
package missinggo
|
|
|
|
import (
|
|
"reflect"
|
|
)
|
|
|
|
// Sets an upper bound on the len of b. max can be any type that will cast to
|
|
// int64.
|
|
func LimitLen(b *[]byte, max interface{}) {
|
|
_max := reflect.ValueOf(max).Int()
|
|
if int64(len(*b)) > _max {
|
|
*b = (*b)[:_max]
|
|
}
|
|
}
|