From 8161aae4ef556918eff1f023bf676b887d5be71e Mon Sep 17 00:00:00 2001 From: what Date: Tue, 26 Nov 2024 15:15:53 +0800 Subject: [PATCH] [fix] Encode Not using characters --- base62.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/base62.go b/base62.go index ec87997..c1d6465 100644 --- a/base62.go +++ b/base62.go @@ -12,15 +12,15 @@ type Base62 struct { charactersMap map[byte]int // base62 编码规则 } -var base62 *Base62 +var _base62 *Base62 func init() { - base62 = &Base62{} - base62.SetCharacters([]byte("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")) + _base62 = &Base62{} + _base62.SetCharacters([]byte("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")) } func GetInstance() *Base62 { - return base62 + return _base62 } func (base62 *Base62) SetCharacters(characters []byte) (*Base62, error) { @@ -42,7 +42,7 @@ func (base62 *Base62) SetCharacters(characters []byte) (*Base62, error) { } // Encode function receives a byte slice and encodes it to a string using the alphabet provided -func (e *Base62) Encode(source []byte) string { +func (base62 *Base62) Encode(source []byte) string { if len(source) == 0 { return "" }