limitlen.go 197 B

1234567
  1. package missinggo
  2. // Sets an upper bound on the len of b. max can be any type that will cast to
  3. // int64.
  4. func LimitLen(b []byte, max ...interface{}) []byte {
  5. return b[:MinInt(len(b), max...)]
  6. }