Skip to content

Commit

Permalink
#1: User golang 1.12 for travis build. Improve random usernames gener…
Browse files Browse the repository at this point in the history
…ator
  • Loading branch information
erickskrauch committed Apr 20, 2019
1 parent 96af45b commit bd099cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sudo: required

language: go
go:
- 1.9
- 1.12

services:
- docker
Expand Down
4 changes: 3 additions & 1 deletion api/mojang/queue/queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit bd099cf

Please sign in to comment.