Skip to content

Commit a2f3c75

Browse files
committed
Merge branch 'v1.1.x'
2 parents 18c619f + 9fbddeb commit a2f3c75

File tree

100 files changed

+12315
-2638
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+12315
-2638
lines changed

coding/base32/base32_bench_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func BenchmarkStdEncoder_EncodeBinary(b *testing.B) {
4747

4848
// BenchmarkStdEncoder_EncodeEmpty benchmarks the standard base32 encoder with empty data
4949
func BenchmarkStdEncoder_EncodeEmpty(b *testing.B) {
50-
data := []byte{}
50+
var data []byte
5151
encoder := NewStdEncoder(StdAlphabet)
5252

5353
b.ResetTimer()
@@ -140,7 +140,7 @@ func BenchmarkStdDecoder_DecodeBinary(b *testing.B) {
140140

141141
// BenchmarkStdDecoder_DecodeEmpty benchmarks the standard base32 decoder with empty data
142142
func BenchmarkStdDecoder_DecodeEmpty(b *testing.B) {
143-
data := []byte{}
143+
var data []byte
144144
decoder := NewStdDecoder(StdAlphabet)
145145

146146
b.ResetTimer()
@@ -280,7 +280,7 @@ func BenchmarkStdDecoder_DecodeWithError(b *testing.B) {
280280
}
281281
}
282282

283-
// BenchmarkStdEncoder_EncodeUnicode benchmarks the standard base32 encoder with unicode data
283+
// BenchmarkStdEncoder_EncodeUnicode benchmarks the standard base32 encoder with Unicode data
284284
func BenchmarkStdEncoder_EncodeUnicode(b *testing.B) {
285285
data := []byte("你好世界,这是一个包含中文的测试字符串")
286286
encoder := NewStdEncoder(StdAlphabet)

coding/base45/base45_unit_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func TestStdEncoder_Encode(t *testing.T) {
172172
t.Run("getOutputSize function direct test", func(t *testing.T) {
173173
encoder := NewStdEncoder()
174174

175-
// Test with zero length (this branch is logically unreachable but we test it for coverage)
175+
// Test with zero length (this branch is logically unreachable, but we test it for coverage)
176176
// Since getOutputSize is a private method, we can't call it directly
177177
// Instead, let's test the edge case by creating a very specific scenario
178178

@@ -320,7 +320,7 @@ func TestStdDecoder_Decode(t *testing.T) {
320320

321321
t.Run("decode with unicode character", func(t *testing.T) {
322322
decoder := NewStdDecoder()
323-
// Create input with unicode character > 255
323+
// Create input with Unicode character > 255
324324
// Use a character that is definitely > 255 (e.g., 0x100 = 256)
325325
// Create a byte slice with a character > 255
326326
unicodeInput := make([]byte, 3)

coding/base58/base58_bench_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func BenchmarkStdEncoder_EncodeBinary(b *testing.B) {
4949

5050
// BenchmarkStdEncoder_EncodeEmpty benchmarks the standard base58 encoder with empty data
5151
func BenchmarkStdEncoder_EncodeEmpty(b *testing.B) {
52-
data := []byte{}
52+
var data []byte
5353
encoder := NewStdEncoder()
5454

5555
b.ResetTimer()
@@ -102,7 +102,7 @@ func BenchmarkStdEncoder_EncodeLargeNumber(b *testing.B) {
102102
}
103103
}
104104

105-
// BenchmarkStdEncoder_EncodeUnicode benchmarks the standard base58 encoder with unicode data
105+
// BenchmarkStdEncoder_EncodeUnicode benchmarks the standard base58 encoder with Unicode data
106106
func BenchmarkStdEncoder_EncodeUnicode(b *testing.B) {
107107
data := []byte("你好世界,这是一个包含中文的测试字符串")
108108
encoder := NewStdEncoder()
@@ -240,7 +240,7 @@ func BenchmarkStdDecoder_DecodeBinary(b *testing.B) {
240240

241241
// BenchmarkStdDecoder_DecodeEmpty benchmarks the standard base58 decoder with empty data
242242
func BenchmarkStdDecoder_DecodeEmpty(b *testing.B) {
243-
data := []byte{}
243+
var data []byte
244244
decoder := NewStdDecoder()
245245

246246
b.ResetTimer()

coding/base62/base62_bench_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func BenchmarkStdEncoder_EncodeBinary(b *testing.B) {
4949

5050
// BenchmarkStdEncoder_EncodeEmpty benchmarks the standard base62 encoder with empty data
5151
func BenchmarkStdEncoder_EncodeEmpty(b *testing.B) {
52-
data := []byte{}
52+
var data []byte
5353
encoder := NewStdEncoder()
5454

5555
b.ResetTimer()
@@ -102,7 +102,7 @@ func BenchmarkStdEncoder_EncodeLargeNumber(b *testing.B) {
102102
}
103103
}
104104

105-
// BenchmarkStdEncoder_EncodeUnicode benchmarks the standard base62 encoder with unicode data
105+
// BenchmarkStdEncoder_EncodeUnicode benchmarks the standard base62 encoder with Unicode data
106106
func BenchmarkStdEncoder_EncodeUnicode(b *testing.B) {
107107
data := []byte("你好世界,这是一个包含中文的测试字符串")
108108
encoder := NewStdEncoder()
@@ -193,7 +193,7 @@ func BenchmarkStdDecoder_DecodeBinary(b *testing.B) {
193193

194194
// BenchmarkStdDecoder_DecodeEmpty benchmarks the standard base62 decoder with empty data
195195
func BenchmarkStdDecoder_DecodeEmpty(b *testing.B) {
196-
data := []byte{}
196+
var data []byte
197197
decoder := NewStdDecoder()
198198

199199
b.ResetTimer()

coding/base64/base64.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (d *StdDecoder) Decode(src []byte) (dst []byte, err error) {
9999
// Try to determine the position of the error
100100
pos := int64(0)
101101
if len(src) > 0 {
102-
// For base64 errors, the position is usually at the beginning
102+
// For base64 errors, the position is usually at the beginning,
103103
// but we can't easily determine the exact position from std library
104104
pos = 0
105105
}

coding/base64/base64_bench_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func BenchmarkStdEncoder_EncodeBinary(b *testing.B) {
4949

5050
// BenchmarkStdEncoder_EncodeEmpty benchmarks the standard base64 encoder with empty data
5151
func BenchmarkStdEncoder_EncodeEmpty(b *testing.B) {
52-
data := []byte{}
52+
var data []byte
5353
encoder := NewStdEncoder(StdAlphabet)
5454

5555
b.ResetTimer()
@@ -92,7 +92,7 @@ func BenchmarkStdEncoder_EncodeURLSafe(b *testing.B) {
9292
}
9393
}
9494

95-
// BenchmarkStdEncoder_EncodeUnicode benchmarks the standard base64 encoder with unicode data
95+
// BenchmarkStdEncoder_EncodeUnicode benchmarks the standard base64 encoder with Unicode data
9696
func BenchmarkStdEncoder_EncodeUnicode(b *testing.B) {
9797
data := []byte("你好世界,这是一个包含中文的测试字符串")
9898
encoder := NewStdEncoder(StdAlphabet)
@@ -175,7 +175,7 @@ func BenchmarkStdDecoder_DecodeBinary(b *testing.B) {
175175

176176
// BenchmarkStdDecoder_DecodeEmpty benchmarks the standard base64 decoder with empty data
177177
func BenchmarkStdDecoder_DecodeEmpty(b *testing.B) {
178-
data := []byte{}
178+
var data []byte
179179
decoder := NewStdDecoder(StdAlphabet)
180180

181181
b.ResetTimer()

coding/base91/base91_bench_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func BenchmarkStdEncoder_EncodeBinary(b *testing.B) {
4949

5050
// BenchmarkStdEncoder_EncodeEmpty benchmarks the standard base91 encoder with empty data
5151
func BenchmarkStdEncoder_EncodeEmpty(b *testing.B) {
52-
data := []byte{}
52+
var data []byte
5353
encoder := NewStdEncoder()
5454

5555
b.ResetTimer()
@@ -81,7 +81,7 @@ func BenchmarkStdEncoder_EncodeBlockSize(b *testing.B) {
8181
}
8282
}
8383

84-
// BenchmarkStdEncoder_EncodeUnicode benchmarks the standard base91 encoder with unicode data
84+
// BenchmarkStdEncoder_EncodeUnicode benchmarks the standard base91 encoder with Unicode data
8585
func BenchmarkStdEncoder_EncodeUnicode(b *testing.B) {
8686
data := []byte("你好世界,这是一个包含中文的测试字符串")
8787
encoder := NewStdEncoder()
@@ -241,7 +241,7 @@ func BenchmarkStdDecoder_DecodeBinary(b *testing.B) {
241241

242242
// BenchmarkStdDecoder_DecodeEmpty benchmarks the standard base91 decoder with empty data
243243
func BenchmarkStdDecoder_DecodeEmpty(b *testing.B) {
244-
data := []byte{}
244+
var data []byte
245245
decoder := NewStdDecoder()
246246

247247
b.ResetTimer()

coding/hex/hex_unit_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ func TestStdEncoder_Encode(t *testing.T) {
9292
encoder := NewStdEncoder()
9393
original := bytes.Repeat([]byte("Hello, World! "), 100)
9494
encoded := encoder.Encode(original)
95-
// Python: (b"Hello, World! " * 100).hex()
9695
expected := bytes.Repeat([]byte("48656c6c6f2c20576f726c642120"), 100)
9796
assert.Equal(t, expected, encoded)
9897
assert.Nil(t, encoder.Error)

coding/morse/morse.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
)
1212

1313
var StdSeparator = " "
14-
var WordSeparator = " " // Double space for word separation
1514

1615
// StdAlphabet is the standard morse code alphabet following international standards.
1716
// Extended to include letters a-z, numbers 0-9, punctuation marks, and special characters.

coding/morse/morse_unit_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func TestStdDecoder_Decode(t *testing.T) {
180180
encoded = []byte("-.-.-- ..--..")
181181
decoded, err = decoder.Decode(encoded)
182182
assert.Nil(t, err)
183-
assert.Equal(t, []byte("!?"), decoded) // ? is the character mapped to ..--.. in our alphabet
183+
assert.Equal(t, []byte("!?"), decoded)
184184

185185
// Test mixed
186186
encoded = []byte(".- .---- -.-.--")
@@ -308,7 +308,7 @@ func TestStreamEncoder_Write(t *testing.T) {
308308
var buf bytes.Buffer
309309
encoder := NewStreamEncoder(&buf)
310310

311-
data := []byte{}
311+
var data []byte
312312
n, err := encoder.Write(data)
313313

314314
assert.Equal(t, 0, n)

0 commit comments

Comments
 (0)