-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-tests-go.txt
832 lines (537 loc) · 19.7 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
Running automated test file(s):
Go packages: prime
===============================================================================
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.028s
user 0m0.014s
sys 0m0.028s
==============================================================================
Running: golangci-lint run --enable-all ./...
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 '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 '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 '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 '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 '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 '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 'structcheck' 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 '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 'exhaustivestruct' is deprecated (since v1.46.0) due to: The owner seems to have abandoned the linter. Replaced by exhaustruct."
nth_prime_test.go:28:6: Error return value is not checked (errcheck)
Nth(10001)
^
nth_prime.go:35: Function 'findPrimeWithSieve' is too long (61 > 60) (funlen)
func findPrimeWithSieve(searchTarget int, limit int) []int {
nth_prime.go:10:140: Comment should end in a period (godot)
// Nth returns the nth prime number. An error must be returned if the nth prime number can't be calculated ('n' is equal or less than zero)
^
nth_prime.go:38:45: `substract` is a misspelling of `subtract` (misspell)
// If limit is greater than 2 and is even, substract 1.
^
nth_prime.go:21:17: var-declaration: should omit type int from declaration of var searchSize; it will be inferred from the right-hand side (revive)
var searchSize int = input * 11
^
nth_prime_test.go:8:23: Using the variable on range scope `tc` in function literal (scopelint)
actual, err := Nth(tc.input)
^
nth_prime_test.go:10:9: Using the variable on range scope `tc` in function literal (scopelint)
case tc.err != "":
^
nth_prime_test.go:12:54: Using the variable on range scope `tc` in function literal (scopelint)
t.Fatalf("Nth(%d) expected error: %q, got: %d", tc.input, tc.err, actual)
^
nth_prime.go:71: unnecessary leading newline (whitespace)
for outer <= sqrtLimit {
nth_prime.go:17:2: declarations should never be cuddled (wsl)
var prime int
^
nth_prime.go:52:2: for statements should only be cuddled with assignments used in the iteration (wsl)
for i := 3; i <= limit; i += 2 {
^
nth_prime.go:68:2: declarations should never be cuddled (wsl)
var square int
^
nth_prime.go:69:2: declarations should never be cuddled (wsl)
var inner int
^
nth_prime_test.go:27:2: for statements should only be cuddled with assignments used in the iteration (wsl)
for i := 0; i < b.N; i++ {
^
cases_test.go:6:5: tests is a global variable (gochecknoglobals)
var tests = []struct {
^
nth_prime.go:13:13: err113: do not define dynamic errors, use wrapped static errors instead: "errors.New(\"the nth prime has to be equal to or greater than 1\")" (goerr113)
return 0, errors.New("the nth prime has to be equal to or greater than 1")
^
nth_prime.go:49:14: mnd: Magic number: 2, in <condition> detected (gomnd)
if limit >= 2 {
^
nth_prime.go:76:38: mnd: Magic number: 2, in <operation> detected (gomnd)
inner = square * (outer * (loop - 2))
^
nth_prime.go:81:39: mnd: Magic number: 2, in <operation> detected (gomnd)
inner = square * (outer * (loop - 2))
^
nth_prime_test.go:5:1: Function TestNth missing the call to method parallel (paralleltest)
func TestNth(t *testing.T) {
^
nth_prime_test.go:6:2: Range statement for test TestNth missing the call to method parallel in test Run (paralleltest)
for _, tc := range tests {
^
cases_test.go:1:9: package should be `prime_test` instead of `prime` (testpackage)
package prime
^
nth_prime_examples_test.go:1:9: package should be `prime_test` instead of `prime` (testpackage)
package prime
^
nth_prime_test.go:1:9: package should be `prime_test` instead of `prime` (testpackage)
package prime
^
real 0m0.531s
user 0m0.774s
sys 0m0.439s
==============================================================================
Exit code: -1
real 0m0.570s
user 0m0.795s
sys 0m0.477s
real 0m0.574s
user 0m0.796s
sys 0m0.479s
===============================================================================
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.014s
sys 0m0.015s
==============================================================================
Running: revive -formatter=stylish ./...
nth_prime.go
(21, 17) https://revive.run/r#var-declaration should omit type int from declaration of var searchSize; it will be inferred from the right-hand side
✖ 1 problem (0 errors) (1 warnings)
real 0m0.058s
user 0m0.023s
sys 0m0.050s
==============================================================================
Exit code: 0
real 0m0.088s
user 0m0.043s
sys 0m0.073s
real 0m0.090s
user 0m0.045s
sys 0m0.074s
===============================================================================
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.001s
sys 0m0.000s
===============================================================================
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.019s
user 0m0.012s
sys 0m0.015s
==============================================================================
Running: go-consistent -v ./...
info: check "./."
internal error: package "errors" without types was imported from "prime"
real 0m0.091s
user 0m0.125s
sys 0m0.094s
==============================================================================
Exit code: -1
real 0m0.122s
user 0m0.143s
sys 0m0.120s
real 0m0.124s
user 0m0.144s
sys 0m0.121s
===============================================================================
Running: ../../.github/citools/go/go-lint-staticcheck
Running Go StaticCheck
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.035s
user 0m0.023s
sys 0m0.019s
==============================================================================
Running: staticcheck -checks=all ./...
nth_prime.go:21:17: should omit type int from declaration; it will be inferred from the right-hand side (ST1023)
real 0m0.189s
user 0m0.274s
sys 0m0.180s
==============================================================================
Exit code: -1
real 0m0.237s
user 0m0.303s
sys 0m0.208s
real 0m0.240s
user 0m0.305s
sys 0m0.208s
===============================================================================
Running: ../../.github/citools/go/go-lint-gocritic
Running Go gocritic
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.021s
user 0m0.010s
sys 0m0.020s
==============================================================================
Running: gocritic check -enableAll ./...
./nth_prime.go:35:1: paramTypeCombine: func(searchTarget int, limit int) []int could be replaced with func(searchTarget, limit int) []int
real 0m0.818s
user 0m2.011s
sys 0m0.321s
==============================================================================
Exit code: -1
real 0m0.851s
user 0m2.028s
sys 0m0.351s
real 0m0.853s
user 0m2.028s
sys 0m0.352s
===============================================================================
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.018s
user 0m0.015s
sys 0m0.011s
==============================================================================
Running: go vet ./...
real 0m0.092s
user 0m0.153s
sys 0m0.116s
==============================================================================
Exit code: 0
real 0m0.120s
user 0m0.176s
sys 0m0.133s
real 0m0.122s
user 0m0.178s
sys 0m0.133s
===============================================================================
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.045s
user 0m0.021s
sys 0m0.050s
==============================================================================
Running: go fix ./...
real 0m0.025s
user 0m0.015s
sys 0m0.020s
==============================================================================
Exit code: 0
real 0m0.093s
user 0m0.047s
sys 0m0.091s
real 0m0.095s
user 0m0.049s
sys 0m0.092s
===============================================================================
Running: ../../.github/citools/go/go-lint-errcheck
Running Go errcheck
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.037s
user 0m0.022s
sys 0m0.034s
==============================================================================
Running: errcheck ./...
nth_prime_test.go:28:6: Nth(10001)
real 0m0.459s
user 0m1.364s
sys 0m0.268s
==============================================================================
Exit code: -1
real 0m0.521s
user 0m1.396s
sys 0m0.324s
real 0m0.523s
user 0m1.396s
sys 0m0.326s
===============================================================================
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.013s
==============================================================================
Running: gocyclo .
13 prime findPrimeWithSieve nth_prime.go:35:1
6 prime TestNth nth_prime_test.go:5:1
3 prime BenchmarkNth nth_prime_test.go:23:1
3 prime Nth nth_prime.go:11:1
2 prime ExampleNth nth_prime_examples_test.go:7:1
real 0m0.002s
user 0m0.000s
sys 0m0.002s
==============================================================================
Exit code: 0
real 0m0.030s
user 0m0.016s
sys 0m0.024s
real 0m0.032s
user 0m0.018s
sys 0m0.024s
===============================================================================
Running: ../../.github/citools/go/go-lint-misspell
Running Go misspell
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: misspell .
nth_prime.go:38:44: "substract" is a misspelling of "subtract"
run-tests-go.txt:49:21: "substract" is a misspelling of "subtract"
run-tests-go.txt:50:44: "substract" is a misspelling of "subtract"
coverage.html:118:51: "substract" is a misspelling of "subtract"
real 0m0.025s
user 0m0.030s
sys 0m0.011s
==============================================================================
Exit code: 0
real 0m0.037s
user 0m0.033s
sys 0m0.025s
real 0m0.040s
user 0m0.034s
sys 0m0.027s
===============================================================================
Running: ../../.github/citools/go/go-lint-gosec
Running Go GoSec
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.023s
user 0m0.015s
sys 0m0.019s
==============================================================================
Running: gosec ./...
[gosec] 2023/09/07 00:25:22 Including rules: default
[gosec] 2023/09/07 00:25:22 Excluding rules: default
[gosec] 2023/09/07 00:25:22 Import directory: /home/vpayno/git_vpayno/exercism-workspace/go/nth-prime
[gosec] 2023/09/07 00:25:22 Checking package: prime
[gosec] 2023/09/07 00:25:22 Checking file: /home/vpayno/git_vpayno/exercism-workspace/go/nth-prime/nth_prime.go
Results:
[1;36mSummary:[0m
Gosec : dev
Files : 1
Lines : 97
Nosec : 0
Issues : [1;32m0[0m
real 0m0.109s
user 0m0.108s
sys 0m0.076s
==============================================================================
Exit code: 0
real 0m0.144s
user 0m0.128s
sys 0m0.106s
real 0m0.146s
user 0m0.130s
sys 0m0.106s
===============================================================================
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.023s
user 0m0.013s
sys 0m0.020s
==============================================================================
Running: gotest -v -covermode=count -coverprofile coverage.out ./...
=== RUN TestNth
=== RUN TestNth/first_prime
=== RUN TestNth/second_prime
=== RUN TestNth/sixth_prime
=== RUN TestNth/big_prime
=== RUN TestNth/there_is_no_zeroth_prime
--- PASS: TestNth (0.03s)
--- PASS: TestNth/first_prime (0.00s)
--- PASS: TestNth/second_prime (0.00s)
--- PASS: TestNth/sixth_prime (0.00s)
--- PASS: TestNth/big_prime (0.03s)
--- PASS: TestNth/there_is_no_zeroth_prime (0.00s)
=== RUN ExampleNth
--- PASS: ExampleNth (0.00s)
PASS
coverage: 100.0% of statements
ok prime 0.031s coverage: 100.0% of statements
real 0m0.213s
user 0m0.293s
sys 0m0.186s
==============================================================================
Running: go tool cover -func=coverage.out
prime/nth_prime.go:11: Nth 100.0%
prime/nth_prime.go:35: findPrimeWithSieve 100.0%
total: (statements) 100.0%
real 0m0.041s
user 0m0.047s
sys 0m0.047s
==============================================================================
Running: go tool cover -html coverage.out -o coverage.html
real 0m0.038s
user 0m0.031s
sys 0m0.060s
==============================================================================
Running: cover_annotate
Running: gocov convert coverage.out | gocov annotate -ceiling=100 - | tee coverage-annotations.txt
real 0m0.015s
user 0m0.014s
sys 0m0.010s
real 0m0.015s
user 0m0.014s
sys 0m0.010s
==============================================================================
Running: gotest -v -race -covermode=atomic ./...
=== RUN TestNth
=== RUN TestNth/first_prime
=== RUN TestNth/second_prime
=== RUN TestNth/sixth_prime
=== RUN TestNth/big_prime
=== RUN TestNth/there_is_no_zeroth_prime
--- PASS: TestNth (0.09s)
--- PASS: TestNth/first_prime (0.00s)
--- PASS: TestNth/second_prime (0.00s)
--- PASS: TestNth/sixth_prime (0.00s)
--- PASS: TestNth/big_prime (0.09s)
--- PASS: TestNth/there_is_no_zeroth_prime (0.00s)
=== RUN ExampleNth
--- PASS: ExampleNth (0.00s)
PASS
coverage: 100.0% of statements
ok prime 1.114s coverage: 100.0% of statements
real 0m1.338s
user 0m0.343s
sys 0m0.171s
==============================================================================
Exit code: 0
real 0m1.678s
user 0m0.747s
sys 0m0.501s
real 0m1.679s
user 0m0.747s
sys 0m0.503s
===============================================================================
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: prime
cpu: 12th Gen Intel(R) Core(TM) i5-1240P
BenchmarkNth
BenchmarkNth-8 54 19159865 ns/op 6984784 B/op 2936 allocs/op
PASS
ok prime 1.060s
real 0m1.215s
user 0m1.257s
sys 0m0.189s
===============================================================================
gotest -v -tags bonus
=== RUN TestNth
=== RUN TestNth/first_prime
=== RUN TestNth/second_prime
=== RUN TestNth/sixth_prime
=== RUN TestNth/big_prime
=== RUN TestNth/there_is_no_zeroth_prime
--- PASS: TestNth (0.03s)
--- PASS: TestNth/first_prime (0.00s)
--- PASS: TestNth/second_prime (0.00s)
--- PASS: TestNth/sixth_prime (0.00s)
--- PASS: TestNth/big_prime (0.03s)
--- PASS: TestNth/there_is_no_zeroth_prime (0.00s)
=== RUN ExampleNth
--- PASS: ExampleNth (0.00s)
PASS
ok prime 0.028s
real 0m0.173s
user 0m0.217s
sys 0m0.172s
===============================================================================
benchstat benchstat-old.txt benchstat-new.txt
benchstat-new.txt:5: missing iteration count
goos: linux
goarch: amd64
pkg: prime
cpu: 12th Gen Intel(R) Core(TM) i5-1240P
│ benchstat-new.txt │
│ sec/op │
Nth-8 19.16m ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95
│ benchstat-new.txt │
│ B/op │
Nth-8 6.661Mi ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95
│ benchstat-new.txt │
│ allocs/op │
Nth-8 2.936k ± ∞ ¹
¹ 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 │
Nth-4 99.13m ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95
│ benchstat-old.txt │
│ B/op │
Nth-4 6.893Mi ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95
│ benchstat-old.txt │
│ allocs/op │
Nth-4 4.761k ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95
real 0m0.007s
user 0m0.001s
sys 0m0.004s
===============================================================================
gomarkdoc --output prime-doc.md
real 0m0.010s
user 0m0.002s
sys 0m0.008s
===============================================================================
go doc -all prime
package prime // import "prime"
Package prime determines the nth prime.
FUNCTIONS
func Nth(input int) (int, error)
Nth returns the nth prime number. An error must be returned if the nth prime
number can't be calculated ('n' is equal or less than zero)
real 0m0.048s
user 0m0.029s
sys 0m0.035s
===============================================================================