-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-tests-go.txt
936 lines (642 loc) · 25.6 KB
/
run-tests-go.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
Running automated test file(s):
Go packages: isbn
===============================================================================
Running: ../../.github/citools/go/go-lint-golangci-lint
Running GoLangCi-Lint
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.027s
user 0m0.022s
sys 0m0.022s
==============================================================================
Running: golangci-lint run --enable-all ./...
level=warning msg="[runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused."
level=warning msg="[runner] The linter 'golint' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive."
level=warning msg="[runner] The linter 'scopelint' is deprecated (since v1.39.0) due to: The repository of the linter has been deprecated by the owner. Replaced by exportloopref."
level=warning msg="[runner] The linter 'nosnakecase' is deprecated (since v1.48.1) due to: The repository of the linter has been deprecated by the owner. Replaced by revive(var-naming)."
level=warning msg="[runner] The linter 'exhaustivestruct' is deprecated (since v1.46.0) due to: The owner seems to have abandoned the linter. Replaced by exhaustruct."
level=warning msg="[runner] The linter 'maligned' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner. Replaced by govet 'fieldalignment'."
level=warning msg="[runner] The linter 'interfacer' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner. "
level=warning msg="[runner] The linter 'ifshort' is deprecated (since v1.48.0) due to: The repository of the linter has been deprecated by the owner. "
level=warning msg="[runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused."
level=warning msg="[runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused."
isbn_verifier_test.go:10:26: Using the variable on range scope `tc` in function literal (scopelint)
actual := IsValidISBN(tc.isbn)
^
isbn_verifier_test.go:11:17: Using the variable on range scope `tc` in function literal (scopelint)
if actual != tc.expected {
^
isbn_verifier_test.go:12:46: Using the variable on range scope `tc` in function literal (scopelint)
t.Errorf("IsValidISBN(%q)=%t, want: %t", tc.isbn, actual, tc.expected)
^
isbn_verifier_test.go:22:2: for statements should only be cuddled with assignments used in the iteration (wsl)
for i := 0; i < b.N; i++ {
^
isbn_verifier.go:11:1: calculated cyclomatic complexity for function IsValidISBN is 11, max is 10 (cyclop)
func IsValidISBN(isbn string) bool {
^
cases_test.go:6:5: testCases is a global variable (gochecknoglobals)
var testCases = []struct {
^
isbn_verifier.go:49:8: mnd: Magic number: 10, in <operation> detected (gomnd)
d := 10 - i
^
isbn_verifier.go:58:2: S1008: should use 'return sum%11 == 0' instead of 'if sum%11 == 0 { return true }; return false' (gosimple)
if sum%11 == 0 {
^
isbn_verifier_test.go:7:1: Function TestIsValidISBN missing the call to method parallel (paralleltest)
func TestIsValidISBN(t *testing.T) {
^
isbn_verifier_test.go:8:2: Range statement for test TestIsValidISBN missing the call to method parallel in test Run (paralleltest)
for _, tc := range testCases {
^
isbn_verifier.go:16:9: variable error has same name as predeclared identifier (predeclared)
match, error := regexp.MatchString(reStr, isbn)
^
cases_test.go:1:9: package should be `isbn_test` instead of `isbn` (testpackage)
package isbn
^
isbn_verifier_examples_test.go:1:9: package should be `isbn_test` instead of `isbn` (testpackage)
package isbn
^
isbn_verifier_test.go:1:9: package should be `isbn_test` instead of `isbn` (testpackage)
package isbn
^
isbn_verifier.go:37:7: variable name 'n' is too short for the scope of its usage (varnamelen)
var n int
^
isbn_verifier.go:32:6: variable name 'i' is too short for the scope of its usage (varnamelen)
for i, r := range isbn {
^
real 0m0.584s
user 0m0.883s
sys 0m0.557s
==============================================================================
Exit code: -1
real 0m0.625s
user 0m0.913s
sys 0m0.589s
real 0m0.627s
user 0m0.915s
sys 0m0.590s
===============================================================================
Running: ../../.github/citools/go/go-lint-revive
Running Go Lint Revive
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.020s
user 0m0.010s
sys 0m0.021s
==============================================================================
Running: revive -formatter=stylish ./...
real 0m0.069s
user 0m0.034s
sys 0m0.055s
==============================================================================
Exit code: 0
real 0m0.101s
user 0m0.052s
sys 0m0.083s
real 0m0.103s
user 0m0.054s
sys 0m0.084s
===============================================================================
Running: ../../.github/citools/go/go-lint-ineffassign
../run-tests: line 41: .github/citools/go/go-lint-ineffassign: No such file or directory
real 0m0.001s
user 0m0.000s
sys 0m0.001s
===============================================================================
Running: ../../.github/citools/go/go-lint-go-consistent
Running Go go-consistent
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.032s
user 0m0.022s
sys 0m0.030s
==============================================================================
Running: go-consistent -v ./...
info: check "./."
internal error: package "regexp" without types was imported from "isbn"
real 0m0.092s
user 0m0.126s
sys 0m0.121s
==============================================================================
Exit code: -1
real 0m0.146s
user 0m0.158s
sys 0m0.172s
real 0m0.150s
user 0m0.160s
sys 0m0.174s
===============================================================================
Running: ../../.github/citools/go/go-lint-staticcheck
Running Go StaticCheck
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.018s
user 0m0.013s
sys 0m0.016s
==============================================================================
Running: staticcheck -checks=all ./...
isbn_verifier.go:58:2: should use 'return sum%11 == 0' instead of 'if sum%11 == 0 { return true }; return false' (S1008)
real 0m0.191s
user 0m0.233s
sys 0m0.159s
==============================================================================
Exit code: -1
real 0m0.219s
user 0m0.251s
sys 0m0.185s
real 0m0.221s
user 0m0.252s
sys 0m0.186s
===============================================================================
Running: ../../.github/citools/go/go-lint-gocritic
Running Go gocritic
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.023s
user 0m0.014s
sys 0m0.019s
==============================================================================
Running: gocritic check -enableAll ./...
./isbn_verifier.go:16:9: builtinShadow: shadowing of predeclared identifier: error
./isbn_verifier.go:28:5: emptyStringTest: replace `len(isbn) == 0` with `isbn == ""`
real 0m0.801s
user 0m1.965s
sys 0m0.278s
==============================================================================
Exit code: -1
real 0m0.837s
user 0m1.985s
sys 0m0.308s
real 0m0.840s
user 0m1.985s
sys 0m0.311s
===============================================================================
Running: ../../.github/citools/go/go-lint-go_vet
Running Go Vet
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.021s
user 0m0.014s
sys 0m0.015s
==============================================================================
Running: go vet ./...
real 0m0.072s
user 0m0.131s
sys 0m0.109s
==============================================================================
Exit code: 0
real 0m0.109s
user 0m0.150s
sys 0m0.134s
real 0m0.112s
user 0m0.150s
sys 0m0.136s
===============================================================================
Running: ../../.github/citools/go/go-fixer-go_fix
Running go fix
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.020s
user 0m0.013s
sys 0m0.020s
==============================================================================
Running: go fix ./...
real 0m0.027s
user 0m0.022s
sys 0m0.024s
==============================================================================
Exit code: 0
real 0m0.058s
user 0m0.041s
sys 0m0.052s
real 0m0.059s
user 0m0.042s
sys 0m0.053s
===============================================================================
Running: ../../.github/citools/go/go-lint-errcheck
Running Go errcheck
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.032s
user 0m0.020s
sys 0m0.028s
==============================================================================
Running: errcheck ./...
real 0m0.454s
user 0m1.320s
sys 0m0.287s
==============================================================================
Exit code: 0
real 0m0.503s
user 0m1.346s
sys 0m0.331s
real 0m0.506s
user 0m1.348s
sys 0m0.332s
===============================================================================
Running: ../../.github/citools/go/go-lint-gocyclo
Running Go gocyclo
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.017s
user 0m0.010s
sys 0m0.017s
==============================================================================
Running: gocyclo .
11 isbn IsValidISBN isbn_verifier.go:11:1
4 isbn BenchmarkIsValidISBN isbn_verifier_test.go:18:1
3 isbn TestIsValidISBN isbn_verifier_test.go:7:1
1 isbn ExampleIsValidISBN isbn_verifier_examples_test.go:7:1
real 0m0.003s
user 0m0.000s
sys 0m0.003s
==============================================================================
Exit code: 0
real 0m0.032s
user 0m0.017s
sys 0m0.030s
real 0m0.033s
user 0m0.017s
sys 0m0.031s
===============================================================================
Running: ../../.github/citools/go/go-lint-misspell
Running Go misspell
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: misspell .
real 0m0.029s
user 0m0.034s
sys 0m0.010s
==============================================================================
Exit code: 0
real 0m0.040s
user 0m0.041s
sys 0m0.018s
real 0m0.043s
user 0m0.043s
sys 0m0.018s
===============================================================================
Running: ../../.github/citools/go/go-lint-gosec
Running Go GoSec
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.030s
user 0m0.025s
sys 0m0.025s
==============================================================================
Running: gosec ./...
[gosec] 2023/09/07 00:24:03 Including rules: default
[gosec] 2023/09/07 00:24:03 Excluding rules: default
[gosec] 2023/09/07 00:24:03 Import directory: /home/vpayno/git_vpayno/exercism-workspace/go/isbn-verifier
[gosec] 2023/09/07 00:24:03 Checking package: isbn
[gosec] 2023/09/07 00:24:03 Checking file: /home/vpayno/git_vpayno/exercism-workspace/go/isbn-verifier/isbn_verifier.go
Results:
[1;36mSummary:[0m
Gosec : dev
Files : 1
Lines : 63
Nosec : 0
Issues : [1;32m0[0m
real 0m0.125s
user 0m0.123s
sys 0m0.127s
==============================================================================
Exit code: 0
real 0m0.175s
user 0m0.157s
sys 0m0.169s
real 0m0.179s
user 0m0.160s
sys 0m0.171s
===============================================================================
Running: ../../.github/citools/go/go-test-cover-report
Running Go Test, Coverage & Reports
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.034s
user 0m0.021s
sys 0m0.031s
==============================================================================
Running: gotest -v -covermode=count -coverprofile coverage.out ./...
=== RUN TestIsValidISBN
=== RUN TestIsValidISBN/valid_isbn
=== RUN TestIsValidISBN/invalid_isbn_check_digit
=== RUN TestIsValidISBN/valid_isbn_with_a_check_digit_of_10
=== RUN TestIsValidISBN/check_digit_is_a_character_other_than_X
=== RUN TestIsValidISBN/invalid_check_digit_in_isbn_is_not_treated_as_zero
=== RUN TestIsValidISBN/invalid_character_in_isbn_is_not_treated_as_zero
=== RUN TestIsValidISBN/X_is_only_valid_as_a_check_digit
=== RUN TestIsValidISBN/valid_isbn_without_separating_dashes
=== RUN TestIsValidISBN/isbn_without_separating_dashes_and_X_as_check_digit
=== RUN TestIsValidISBN/isbn_without_check_digit_and_dashes
=== RUN TestIsValidISBN/too_long_isbn_and_no_dashes
=== RUN TestIsValidISBN/too_short_isbn
=== RUN TestIsValidISBN/isbn_without_check_digit
=== RUN TestIsValidISBN/check_digit_of_X_should_not_be_used_for_0
=== RUN TestIsValidISBN/empty_isbn
=== RUN TestIsValidISBN/input_is_9_characters
=== RUN TestIsValidISBN/invalid_characters_are_not_ignored_after_checking_length
=== RUN TestIsValidISBN/invalid_characters_are_not_ignored_before_checking_length
=== RUN TestIsValidISBN/input_is_too_long_but_contains_a_valid_isbn
--- PASS: TestIsValidISBN (0.00s)
--- PASS: TestIsValidISBN/valid_isbn (0.00s)
--- PASS: TestIsValidISBN/invalid_isbn_check_digit (0.00s)
--- PASS: TestIsValidISBN/valid_isbn_with_a_check_digit_of_10 (0.00s)
--- PASS: TestIsValidISBN/check_digit_is_a_character_other_than_X (0.00s)
--- PASS: TestIsValidISBN/invalid_check_digit_in_isbn_is_not_treated_as_zero (0.00s)
--- PASS: TestIsValidISBN/invalid_character_in_isbn_is_not_treated_as_zero (0.00s)
--- PASS: TestIsValidISBN/X_is_only_valid_as_a_check_digit (0.00s)
--- PASS: TestIsValidISBN/valid_isbn_without_separating_dashes (0.00s)
--- PASS: TestIsValidISBN/isbn_without_separating_dashes_and_X_as_check_digit (0.00s)
--- PASS: TestIsValidISBN/isbn_without_check_digit_and_dashes (0.00s)
--- PASS: TestIsValidISBN/too_long_isbn_and_no_dashes (0.00s)
--- PASS: TestIsValidISBN/too_short_isbn (0.00s)
--- PASS: TestIsValidISBN/isbn_without_check_digit (0.00s)
--- PASS: TestIsValidISBN/check_digit_of_X_should_not_be_used_for_0 (0.00s)
--- PASS: TestIsValidISBN/empty_isbn (0.00s)
--- PASS: TestIsValidISBN/input_is_9_characters (0.00s)
--- PASS: TestIsValidISBN/invalid_characters_are_not_ignored_after_checking_length (0.00s)
--- PASS: TestIsValidISBN/invalid_characters_are_not_ignored_before_checking_length (0.00s)
--- PASS: TestIsValidISBN/input_is_too_long_but_contains_a_valid_isbn (0.00s)
=== RUN ExampleIsValidISBN
--- PASS: ExampleIsValidISBN (0.00s)
PASS
coverage: 88.5% of statements
ok isbn 0.003s coverage: 88.5% of statements
real 0m0.187s
user 0m0.248s
sys 0m0.162s
==============================================================================
Running: go tool cover -func=coverage.out
isbn/isbn_verifier.go:11: IsValidISBN 88.5%
total: (statements) 88.5%
real 0m0.047s
user 0m0.059s
sys 0m0.070s
==============================================================================
Running: go tool cover -html coverage.out -o coverage.html
real 0m0.045s
user 0m0.042s
sys 0m0.058s
==============================================================================
Running: cover_annotate
Running: gocov convert coverage.out | gocov annotate -ceiling=100 - | tee coverage-annotations.txt
11 func IsValidISBN(isbn string) bool {
12 var sum int
13
14 reStr := `^[0-9][0-9-]+([0-9]|X)$`
15
16 match, error := regexp.MatchString(reStr, isbn)
17
18 if error != nil {
19 MISS panic(error)
20 }
21
22 if !match {
23 return false
24 }
25
26 isbn = strings.ReplaceAll(isbn, "-", "")
27
28 if len(isbn) == 0 || len(isbn) < 10 {
29 return false
30 }
31
32 for i, r := range isbn {
33 if r == '-' {
34 MISS continue
35 }
36
37 var n int
38
39 if r == 'X' {
40 n = 10
41 } else {
42 n, error = strconv.Atoi(string(r))
43
44 if error != nil {
45 MISS panic(error)
46 }
47 }
48
49 d := 10 - i
50
51 if d < 1 {
52 return false
53 }
54
55 sum += n * d
56 }
57
58 if sum%11 == 0 {
59 return true
60 }
61
62 return false
63 }
real 0m0.018s
user 0m0.017s
sys 0m0.013s
real 0m0.019s
user 0m0.017s
sys 0m0.013s
==============================================================================
Running: gotest -v -race -covermode=atomic ./...
=== RUN TestIsValidISBN
=== RUN TestIsValidISBN/valid_isbn
=== RUN TestIsValidISBN/invalid_isbn_check_digit
=== RUN TestIsValidISBN/valid_isbn_with_a_check_digit_of_10
=== RUN TestIsValidISBN/check_digit_is_a_character_other_than_X
=== RUN TestIsValidISBN/invalid_check_digit_in_isbn_is_not_treated_as_zero
=== RUN TestIsValidISBN/invalid_character_in_isbn_is_not_treated_as_zero
=== RUN TestIsValidISBN/X_is_only_valid_as_a_check_digit
=== RUN TestIsValidISBN/valid_isbn_without_separating_dashes
=== RUN TestIsValidISBN/isbn_without_separating_dashes_and_X_as_check_digit
=== RUN TestIsValidISBN/isbn_without_check_digit_and_dashes
=== RUN TestIsValidISBN/too_long_isbn_and_no_dashes
=== RUN TestIsValidISBN/too_short_isbn
=== RUN TestIsValidISBN/isbn_without_check_digit
=== RUN TestIsValidISBN/check_digit_of_X_should_not_be_used_for_0
=== RUN TestIsValidISBN/empty_isbn
=== RUN TestIsValidISBN/input_is_9_characters
=== RUN TestIsValidISBN/invalid_characters_are_not_ignored_after_checking_length
=== RUN TestIsValidISBN/invalid_characters_are_not_ignored_before_checking_length
=== RUN TestIsValidISBN/input_is_too_long_but_contains_a_valid_isbn
--- PASS: TestIsValidISBN (0.00s)
--- PASS: TestIsValidISBN/valid_isbn (0.00s)
--- PASS: TestIsValidISBN/invalid_isbn_check_digit (0.00s)
--- PASS: TestIsValidISBN/valid_isbn_with_a_check_digit_of_10 (0.00s)
--- PASS: TestIsValidISBN/check_digit_is_a_character_other_than_X (0.00s)
--- PASS: TestIsValidISBN/invalid_check_digit_in_isbn_is_not_treated_as_zero (0.00s)
--- PASS: TestIsValidISBN/invalid_character_in_isbn_is_not_treated_as_zero (0.00s)
--- PASS: TestIsValidISBN/X_is_only_valid_as_a_check_digit (0.00s)
--- PASS: TestIsValidISBN/valid_isbn_without_separating_dashes (0.00s)
--- PASS: TestIsValidISBN/isbn_without_separating_dashes_and_X_as_check_digit (0.00s)
--- PASS: TestIsValidISBN/isbn_without_check_digit_and_dashes (0.00s)
--- PASS: TestIsValidISBN/too_long_isbn_and_no_dashes (0.00s)
--- PASS: TestIsValidISBN/too_short_isbn (0.00s)
--- PASS: TestIsValidISBN/isbn_without_check_digit (0.00s)
--- PASS: TestIsValidISBN/check_digit_of_X_should_not_be_used_for_0 (0.00s)
--- PASS: TestIsValidISBN/empty_isbn (0.00s)
--- PASS: TestIsValidISBN/input_is_9_characters (0.00s)
--- PASS: TestIsValidISBN/invalid_characters_are_not_ignored_after_checking_length (0.00s)
--- PASS: TestIsValidISBN/invalid_characters_are_not_ignored_before_checking_length (0.00s)
--- PASS: TestIsValidISBN/input_is_too_long_but_contains_a_valid_isbn (0.00s)
=== RUN ExampleIsValidISBN
--- PASS: ExampleIsValidISBN (0.00s)
PASS
coverage: 88.5% of statements
ok isbn 1.017s coverage: 88.5% of statements
real 0m1.228s
user 0m0.279s
sys 0m0.160s
==============================================================================
Exit code: 0
real 0m1.580s
user 0m0.675s
sys 0m0.512s
real 0m1.583s
user 0m0.676s
sys 0m0.514s
===============================================================================
mv -v benchstat-new.txt benchstat-old.txt
renamed 'benchstat-new.txt' -> 'benchstat-old.txt'
gotest -v --run=xxx --bench . --benchmem |& tee benchstat-new.txt
goos: linux
goarch: amd64
pkg: isbn
cpu: 12th Gen Intel(R) Core(TM) i5-1240P
BenchmarkIsValidISBN
BenchmarkIsValidISBN-8 18230 62404 ns/op 79851 B/op 917 allocs/op
PASS
ok isbn 1.744s
real 0m1.897s
user 0m2.043s
sys 0m0.208s
===============================================================================
gotest -v -tags bonus
=== RUN TestIsValidISBN
=== RUN TestIsValidISBN/valid_isbn
=== RUN TestIsValidISBN/invalid_isbn_check_digit
=== RUN TestIsValidISBN/valid_isbn_with_a_check_digit_of_10
=== RUN TestIsValidISBN/check_digit_is_a_character_other_than_X
=== RUN TestIsValidISBN/invalid_check_digit_in_isbn_is_not_treated_as_zero
=== RUN TestIsValidISBN/invalid_character_in_isbn_is_not_treated_as_zero
=== RUN TestIsValidISBN/X_is_only_valid_as_a_check_digit
=== RUN TestIsValidISBN/valid_isbn_without_separating_dashes
=== RUN TestIsValidISBN/isbn_without_separating_dashes_and_X_as_check_digit
=== RUN TestIsValidISBN/isbn_without_check_digit_and_dashes
=== RUN TestIsValidISBN/too_long_isbn_and_no_dashes
=== RUN TestIsValidISBN/too_short_isbn
=== RUN TestIsValidISBN/isbn_without_check_digit
=== RUN TestIsValidISBN/check_digit_of_X_should_not_be_used_for_0
=== RUN TestIsValidISBN/empty_isbn
=== RUN TestIsValidISBN/input_is_9_characters
=== RUN TestIsValidISBN/invalid_characters_are_not_ignored_after_checking_length
=== RUN TestIsValidISBN/invalid_characters_are_not_ignored_before_checking_length
=== RUN TestIsValidISBN/input_is_too_long_but_contains_a_valid_isbn
--- PASS: TestIsValidISBN (0.00s)
--- PASS: TestIsValidISBN/valid_isbn (0.00s)
--- PASS: TestIsValidISBN/invalid_isbn_check_digit (0.00s)
--- PASS: TestIsValidISBN/valid_isbn_with_a_check_digit_of_10 (0.00s)
--- PASS: TestIsValidISBN/check_digit_is_a_character_other_than_X (0.00s)
--- PASS: TestIsValidISBN/invalid_check_digit_in_isbn_is_not_treated_as_zero (0.00s)
--- PASS: TestIsValidISBN/invalid_character_in_isbn_is_not_treated_as_zero (0.00s)
--- PASS: TestIsValidISBN/X_is_only_valid_as_a_check_digit (0.00s)
--- PASS: TestIsValidISBN/valid_isbn_without_separating_dashes (0.00s)
--- PASS: TestIsValidISBN/isbn_without_separating_dashes_and_X_as_check_digit (0.00s)
--- PASS: TestIsValidISBN/isbn_without_check_digit_and_dashes (0.00s)
--- PASS: TestIsValidISBN/too_long_isbn_and_no_dashes (0.00s)
--- PASS: TestIsValidISBN/too_short_isbn (0.00s)
--- PASS: TestIsValidISBN/isbn_without_check_digit (0.00s)
--- PASS: TestIsValidISBN/check_digit_of_X_should_not_be_used_for_0 (0.00s)
--- PASS: TestIsValidISBN/empty_isbn (0.00s)
--- PASS: TestIsValidISBN/input_is_9_characters (0.00s)
--- PASS: TestIsValidISBN/invalid_characters_are_not_ignored_after_checking_length (0.00s)
--- PASS: TestIsValidISBN/invalid_characters_are_not_ignored_before_checking_length (0.00s)
--- PASS: TestIsValidISBN/input_is_too_long_but_contains_a_valid_isbn (0.00s)
=== RUN ExampleIsValidISBN
--- PASS: ExampleIsValidISBN (0.00s)
PASS
ok isbn 0.002s
real 0m0.126s
user 0m0.179s
sys 0m0.116s
===============================================================================
benchstat benchstat-old.txt benchstat-new.txt
benchstat-new.txt:5: missing iteration count
goos: linux
goarch: amd64
pkg: isbn
cpu: 12th Gen Intel(R) Core(TM) i5-1240P
│ benchstat-new.txt │
│ sec/op │
IsValidISBN-8 62.40µ ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95
│ benchstat-new.txt │
│ B/op │
IsValidISBN-8 77.98Ki ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95
│ benchstat-new.txt │
│ allocs/op │
IsValidISBN-8 917.0 ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95
cpu: Intel(R) Core(TM) i7-7Y75 CPU @ 1.30GHz
│ benchstat-old.txt │
│ sec/op │
IsValidISBN-4 221.0µ ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95
│ benchstat-old.txt │
│ B/op │
IsValidISBN-4 78.21Ki ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95
│ benchstat-old.txt │
│ allocs/op │
IsValidISBN-4 995.0 ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95
real 0m0.003s
user 0m0.001s
sys 0m0.002s
===============================================================================
gomarkdoc --output isbn-doc.md
real 0m0.009s
user 0m0.005s
sys 0m0.004s
===============================================================================
go doc -all isbn
package isbn // import "isbn"
Package isbn is used to validate book id numbers.
FUNCTIONS
func IsValidISBN(isbn string) bool
IsValidISBN returns true if the book id number is valid.
real 0m0.035s
user 0m0.021s
sys 0m0.030s
===============================================================================