pkg/pools: Use pool for strings.Builder everywhere

This commit is contained in:
Tom Wiesing 2023-01-24 10:52:15 +01:00
parent 8af2213d5a
commit a63bb2f669
No known key found for this signature in database
7 changed files with 44 additions and 25 deletions

View file

@ -4,7 +4,8 @@ package password
import (
"crypto/rand"
"math/big"
"strings"
"github.com/FAU-CDI/wisski-distillery/pkg/pools"
)
// NOTE(twiesing): A bunch of scripts cannot properly handle the extra characters in the password.
@ -23,7 +24,8 @@ func Password(length int) (string, error) {
}
// create a buffer to write the string to!
var password strings.Builder
password := pools.GetBuilder()
defer pools.ReleaseBuilder(password)
password.Grow(length)
for i := 0; i < length; i++ {