mirror of
https://github.com/elyby/chrly.git
synced 2024-12-23 21:50:03 +05:30
#1: User golang 1.12 for travis build. Improve random usernames generator
This commit is contained in:
parent
96af45b2a1
commit
bd099cfb2a
@ -2,7 +2,7 @@ sudo: required
|
||||
|
||||
language: go
|
||||
go:
|
||||
- 1.9
|
||||
- 1.12
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
@ -261,11 +261,13 @@ func TestJobsQueueSuite(t *testing.T) {
|
||||
suite.Run(t, new(QueueTestSuite))
|
||||
}
|
||||
|
||||
var replacer = strings.NewReplacer("-", "_", "=", "")
|
||||
|
||||
// https://stackoverflow.com/a/50581165
|
||||
func randStr(len int) string {
|
||||
buff := make([]byte, len)
|
||||
_, _ = rand.Read(buff)
|
||||
str := strings.ReplaceAll(base64.URLEncoding.EncodeToString(buff), "-", "_")
|
||||
str := replacer.Replace(base64.URLEncoding.EncodeToString(buff))
|
||||
|
||||
// Base 64 can be longer than len
|
||||
return str[:len]
|
||||
|
Loading…
Reference in New Issue
Block a user