Refactor variable initialization in generateBinary function

This commit refactors the way the 'length' variable is initialized in the generateBinary function of the Generator struct in random.go. Notably, it makes use of Go's type inference feature to eliminate the need to explicitly declare the variable type.
This commit is contained in:
Winni Neessen 2024-03-17 18:12:17 +01:00
parent acadccc84a
commit c8a4cf2837
Signed by: wneessen
GPG key ID: 5F3AF39B820C119D

View file

@ -321,7 +321,7 @@ func (g *Generator) generatePronounceable() (string, error) {
// generateBinary is executed when Generate() is called with Algorithm set
// to AlgoBinary
func (g *Generator) generateBinary() (string, error) {
var length int64 = DefaultBinarySize
length := DefaultBinarySize
if g.config.FixedLength > 0 {
length = g.config.FixedLength
}