44 "bytes"
55 "compress/gzip"
66 "encoding/binary"
7- "io/ioutil "
7+ "io"
88 "math"
99 "os"
1010 "path/filepath"
@@ -72,7 +72,7 @@ func BenchmarkEncode(b *testing.B) {
7272 for name , bb := range benchs {
7373 bb := bb
7474 b .Run (name , func (b * testing.B ) {
75- enc := NewEncoder (ioutil .Discard )
75+ enc := NewEncoder (io .Discard )
7676 b .ResetTimer ()
7777 for i := 0 ; i < b .N ; i ++ {
7878 if err := enc .Encode (bb .value ); err != nil {
@@ -86,7 +86,7 @@ func BenchmarkEncode(b *testing.B) {
8686 b .Run ("Parallel/" + name , func (b * testing.B ) {
8787 b .RunParallel (func (pb * testing.PB ) {
8888 for pb .Next () {
89- enc := NewEncoder (ioutil .Discard )
89+ enc := NewEncoder (io .Discard )
9090 if err := enc .Encode (bb .value ); err != nil {
9191 b .Fatal (err )
9292 }
@@ -100,7 +100,7 @@ func BenchmarkPackBool(b *testing.B) {
100100 b .ReportAllocs ()
101101
102102 b .Run ("False" , func (b * testing.B ) {
103- enc := NewEncoder (ioutil .Discard )
103+ enc := NewEncoder (io .Discard )
104104 b .ResetTimer ()
105105 for i := 0 ; i < b .N ; i ++ {
106106 v := false
@@ -111,7 +111,7 @@ func BenchmarkPackBool(b *testing.B) {
111111 })
112112
113113 b .Run ("True" , func (b * testing.B ) {
114- enc := NewEncoder (ioutil .Discard )
114+ enc := NewEncoder (io .Discard )
115115 b .ResetTimer ()
116116 for i := 0 ; i < b .N ; i ++ {
117117 v := true
@@ -125,7 +125,7 @@ func BenchmarkPackBool(b *testing.B) {
125125func BenchmarkPackUint8 (b * testing.B ) {
126126 b .ReportAllocs ()
127127
128- enc := NewEncoder (ioutil .Discard )
128+ enc := NewEncoder (io .Discard )
129129 b .ResetTimer ()
130130 for i := 0 ; i < b .N ; i ++ {
131131 v := uint64 (math .MaxUint8 )
@@ -138,7 +138,7 @@ func BenchmarkPackUint8(b *testing.B) {
138138func BenchmarkPackUint16 (b * testing.B ) {
139139 b .ReportAllocs ()
140140
141- enc := NewEncoder (ioutil .Discard )
141+ enc := NewEncoder (io .Discard )
142142 b .ResetTimer ()
143143 for i := 0 ; i < b .N ; i ++ {
144144 v := uint64 (math .MaxUint16 )
@@ -151,7 +151,7 @@ func BenchmarkPackUint16(b *testing.B) {
151151func BenchmarkPackUint32 (b * testing.B ) {
152152 b .ReportAllocs ()
153153
154- enc := NewEncoder (ioutil .Discard )
154+ enc := NewEncoder (io .Discard )
155155 b .ResetTimer ()
156156 for i := 0 ; i < b .N ; i ++ {
157157 v := uint64 (math .MaxUint32 )
@@ -164,7 +164,7 @@ func BenchmarkPackUint32(b *testing.B) {
164164func BenchmarkPackUint64 (b * testing.B ) {
165165 b .ReportAllocs ()
166166
167- enc := NewEncoder (ioutil .Discard )
167+ enc := NewEncoder (io .Discard )
168168 b .ResetTimer ()
169169 for i := 0 ; i < b .N ; i ++ {
170170 v := uint64 (math .MaxUint64 )
@@ -177,7 +177,7 @@ func BenchmarkPackUint64(b *testing.B) {
177177func BenchmarkPackInt8 (b * testing.B ) {
178178 b .ReportAllocs ()
179179
180- enc := NewEncoder (ioutil .Discard )
180+ enc := NewEncoder (io .Discard )
181181 b .ResetTimer ()
182182 for i := 0 ; i < b .N ; i ++ {
183183 v := int64 (math .MaxInt8 )
@@ -190,7 +190,7 @@ func BenchmarkPackInt8(b *testing.B) {
190190func BenchmarkPackInt16 (b * testing.B ) {
191191 b .ReportAllocs ()
192192
193- enc := NewEncoder (ioutil .Discard )
193+ enc := NewEncoder (io .Discard )
194194 b .ResetTimer ()
195195 for i := 0 ; i < b .N ; i ++ {
196196 v := int64 (math .MaxInt16 )
@@ -203,7 +203,7 @@ func BenchmarkPackInt16(b *testing.B) {
203203func BenchmarkPackInt32 (b * testing.B ) {
204204 b .ReportAllocs ()
205205
206- enc := NewEncoder (ioutil .Discard )
206+ enc := NewEncoder (io .Discard )
207207 b .ResetTimer ()
208208 for i := 0 ; i < b .N ; i ++ {
209209 v := int64 (math .MaxInt32 )
@@ -216,7 +216,7 @@ func BenchmarkPackInt32(b *testing.B) {
216216func BenchmarkPackInt64 (b * testing.B ) {
217217 b .ReportAllocs ()
218218
219- enc := NewEncoder (ioutil .Discard )
219+ enc := NewEncoder (io .Discard )
220220 b .ResetTimer ()
221221 for i := 0 ; i < b .N ; i ++ {
222222 v := int64 (math .MaxInt64 )
@@ -229,7 +229,7 @@ func BenchmarkPackInt64(b *testing.B) {
229229func BenchmarkPackFloat32 (b * testing.B ) {
230230 b .ReportAllocs ()
231231
232- enc := NewEncoder (ioutil .Discard )
232+ enc := NewEncoder (io .Discard )
233233 b .ResetTimer ()
234234 for i := 0 ; i < b .N ; i ++ {
235235 v := float64 (math .MaxFloat32 )
@@ -242,7 +242,7 @@ func BenchmarkPackFloat32(b *testing.B) {
242242func BenchmarkPackFloat64 (b * testing.B ) {
243243 b .ReportAllocs ()
244244
245- enc := NewEncoder (ioutil .Discard )
245+ enc := NewEncoder (io .Discard )
246246 b .ResetTimer ()
247247 for i := 0 ; i < b .N ; i ++ {
248248 v := float64 (math .MaxFloat64 )
@@ -256,7 +256,7 @@ func BenchmarkPackString(b *testing.B) {
256256 b .ReportAllocs ()
257257
258258 b .Run ("MaxUint8" , func (b * testing.B ) {
259- enc := NewEncoder (ioutil .Discard )
259+ enc := NewEncoder (io .Discard )
260260 s := makeString (math .MaxUint8 )
261261 b .ResetTimer ()
262262 for i := 0 ; i < b .N ; i ++ {
@@ -267,7 +267,7 @@ func BenchmarkPackString(b *testing.B) {
267267 })
268268
269269 b .Run ("MaxUint8+1" , func (b * testing.B ) {
270- enc := NewEncoder (ioutil .Discard )
270+ enc := NewEncoder (io .Discard )
271271 s := makeString (math .MaxUint8 + 1 )
272272 b .ResetTimer ()
273273 for i := 0 ; i < b .N ; i ++ {
@@ -278,7 +278,7 @@ func BenchmarkPackString(b *testing.B) {
278278 })
279279
280280 b .Run ("MaxUint16" , func (b * testing.B ) {
281- enc := NewEncoder (ioutil .Discard )
281+ enc := NewEncoder (io .Discard )
282282 s := makeString (math .MaxUint16 )
283283 b .ResetTimer ()
284284 for i := 0 ; i < b .N ; i ++ {
@@ -293,7 +293,7 @@ func BenchmarkPackStringBytes(b *testing.B) {
293293 b .ReportAllocs ()
294294
295295 b .Run ("MaxUint8" , func (b * testing.B ) {
296- enc := NewEncoder (ioutil .Discard )
296+ enc := NewEncoder (io .Discard )
297297 p := []byte (makeString (math .MaxUint8 ))
298298 b .ResetTimer ()
299299 for i := 0 ; i < b .N ; i ++ {
@@ -304,7 +304,7 @@ func BenchmarkPackStringBytes(b *testing.B) {
304304 })
305305
306306 b .Run ("MaxUint8+1" , func (b * testing.B ) {
307- enc := NewEncoder (ioutil .Discard )
307+ enc := NewEncoder (io .Discard )
308308 p := []byte (makeString (math .MaxUint8 + 1 ))
309309 b .ResetTimer ()
310310 for i := 0 ; i < b .N ; i ++ {
@@ -315,7 +315,7 @@ func BenchmarkPackStringBytes(b *testing.B) {
315315 })
316316
317317 b .Run ("MaxUint16" , func (b * testing.B ) {
318- enc := NewEncoder (ioutil .Discard )
318+ enc := NewEncoder (io .Discard )
319319 p := []byte (makeString (math .MaxUint16 ))
320320 b .ResetTimer ()
321321 for i := 0 ; i < b .N ; i ++ {
@@ -330,7 +330,7 @@ func BenchmarkPackBinary(b *testing.B) {
330330 b .ReportAllocs ()
331331
332332 b .Run ("MaxUint8" , func (b * testing.B ) {
333- enc := NewEncoder (ioutil .Discard )
333+ enc := NewEncoder (io .Discard )
334334 p := []byte (makeString (math .MaxUint8 ))
335335 b .ResetTimer ()
336336 for i := 0 ; i < b .N ; i ++ {
@@ -341,7 +341,7 @@ func BenchmarkPackBinary(b *testing.B) {
341341 })
342342
343343 b .Run ("MaxUint8+1" , func (b * testing.B ) {
344- enc := NewEncoder (ioutil .Discard )
344+ enc := NewEncoder (io .Discard )
345345 p := []byte (makeString (math .MaxUint8 + 1 ))
346346 b .ResetTimer ()
347347 for i := 0 ; i < b .N ; i ++ {
@@ -352,7 +352,7 @@ func BenchmarkPackBinary(b *testing.B) {
352352 })
353353
354354 b .Run ("MaxUint16" , func (b * testing.B ) {
355- enc := NewEncoder (ioutil .Discard )
355+ enc := NewEncoder (io .Discard )
356356 p := []byte (makeString (math .MaxUint16 ))
357357 b .ResetTimer ()
358358 for i := 0 ; i < b .N ; i ++ {
@@ -367,7 +367,7 @@ func BenchmarkPackArrayLen(b *testing.B) {
367367 b .ReportAllocs ()
368368
369369 b .Run ("MaxUint8" , func (b * testing.B ) {
370- enc := NewEncoder (ioutil .Discard )
370+ enc := NewEncoder (io .Discard )
371371 v := int64 (math .MaxUint8 )
372372 b .ResetTimer ()
373373 for i := 0 ; i < b .N ; i ++ {
@@ -378,7 +378,7 @@ func BenchmarkPackArrayLen(b *testing.B) {
378378 })
379379
380380 b .Run ("MaxUint16" , func (b * testing.B ) {
381- enc := NewEncoder (ioutil .Discard )
381+ enc := NewEncoder (io .Discard )
382382 v := int64 (math .MaxUint16 )
383383 b .ResetTimer ()
384384 for i := 0 ; i < b .N ; i ++ {
@@ -389,7 +389,7 @@ func BenchmarkPackArrayLen(b *testing.B) {
389389 })
390390
391391 b .Run ("MaxUint32" , func (b * testing.B ) {
392- enc := NewEncoder (ioutil .Discard )
392+ enc := NewEncoder (io .Discard )
393393 v := int64 (math .MaxUint32 )
394394 b .ResetTimer ()
395395 for i := 0 ; i < b .N ; i ++ {
@@ -404,7 +404,7 @@ func BenchmarkPackMapLen(b *testing.B) {
404404 b .ReportAllocs ()
405405
406406 b .Run ("MaxUint8" , func (b * testing.B ) {
407- enc := NewEncoder (ioutil .Discard )
407+ enc := NewEncoder (io .Discard )
408408 v := int64 (math .MaxUint8 )
409409 b .ResetTimer ()
410410 for i := 0 ; i < b .N ; i ++ {
@@ -415,7 +415,7 @@ func BenchmarkPackMapLen(b *testing.B) {
415415 })
416416
417417 b .Run ("MaxUint16" , func (b * testing.B ) {
418- enc := NewEncoder (ioutil .Discard )
418+ enc := NewEncoder (io .Discard )
419419 v := int64 (math .MaxUint16 )
420420 b .ResetTimer ()
421421 for i := 0 ; i < b .N ; i ++ {
@@ -426,7 +426,7 @@ func BenchmarkPackMapLen(b *testing.B) {
426426 })
427427
428428 b .Run ("MaxUint32" , func (b * testing.B ) {
429- enc := NewEncoder (ioutil .Discard )
429+ enc := NewEncoder (io .Discard )
430430 v := int64 (math .MaxUint32 )
431431 b .ResetTimer ()
432432 for i := 0 ; i < b .N ; i ++ {
@@ -1468,7 +1468,7 @@ func extractMpack(tb testing.TB, path string) []byte {
14681468 tb .Fatal (err )
14691469 }
14701470
1471- data , err := ioutil .ReadAll (gz )
1471+ data , err := io .ReadAll (gz )
14721472 if err != nil {
14731473 tb .Fatal (err )
14741474 }
@@ -1490,7 +1490,7 @@ func BenchmarkEncodeMpack(b *testing.B) {
14901490 b .ResetTimer ()
14911491
14921492 b .RunParallel (func (pb * testing.PB ) {
1493- enc := NewEncoder (ioutil .Discard )
1493+ enc := NewEncoder (io .Discard )
14941494 for pb .Next () {
14951495 if err := enc .Encode (& structAPI ); err != nil {
14961496 b .Fatalf ("Decode: %v" , err )
@@ -1512,7 +1512,7 @@ func BenchmarkEncodeMpack(b *testing.B) {
15121512 b .ResetTimer ()
15131513
15141514 b .RunParallel (func (pb * testing.PB ) {
1515- enc := NewEncoder (ioutil .Discard )
1515+ enc := NewEncoder (io .Discard )
15161516 for pb .Next () {
15171517 if err := enc .Encode (& structAPIMetadata ); err != nil {
15181518 b .Fatalf ("Decode: %v" , err )
@@ -1534,7 +1534,7 @@ func BenchmarkEncodeMpack(b *testing.B) {
15341534 b .ResetTimer ()
15351535
15361536 b .RunParallel (func (pb * testing.PB ) {
1537- enc := NewEncoder (ioutil .Discard )
1537+ enc := NewEncoder (io .Discard )
15381538 for pb .Next () {
15391539 if err := enc .Encode (& structAPIMetadata ); err != nil {
15401540 b .Fatalf ("Decode: %v" , err )
@@ -1556,7 +1556,7 @@ func BenchmarkEncodeMpack(b *testing.B) {
15561556 b .ResetTimer ()
15571557
15581558 b .RunParallel (func (pb * testing.PB ) {
1559- enc := NewEncoder (ioutil .Discard )
1559+ enc := NewEncoder (io .Discard )
15601560 for pb .Next () {
15611561 if err := enc .Encode (& structFuncsData ); err != nil {
15621562 b .Fatalf ("Decode: %v" , err )
0 commit comments