move getLastLine func to where it's used
Vladimir Bauer
4 years ago
| 287 | 287 | return "" |
| 288 | 288 | }) |
| 289 | 289 | } |
| 290 | ||
| 291 | func getLastLine(bb []byte) []byte { | |
| 292 | split := bytes.Split(bb, []byte("\n")) | |
| 293 | return split[len(split)-2] | |
| 294 | } |
| 0 | 0 | package mpb_test |
| 1 | 1 | |
| 2 | 2 | import ( |
| 3 | "bytes" | |
| 4 | 3 | "context" |
| 5 | 4 | "io/ioutil" |
| 6 | 5 | "math/rand" |
| 188 | 187 | } |
| 189 | 188 | } |
| 190 | 189 | |
| 191 | func getLastLine(bb []byte) []byte { | |
| 192 | split := bytes.Split(bb, []byte("\n")) | |
| 193 | return split[len(split)-2] | |
| 194 | } | |
| 195 | ||
| 196 | 190 | func randomDuration(max time.Duration) time.Duration { |
| 197 | 191 | return time.Duration(rand.Intn(10)+1) * max / 10 |
| 198 | 192 | } |