Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #54 from maratori/linter
Browse files Browse the repository at this point in the history
Fix linter
  • Loading branch information
maratori authored Aug 28, 2022
2 parents 15d381f + 4a8ee70 commit 4f2c3ee
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
9 changes: 7 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ run:
# Timeout for analysis, e.g. 30s, 5m.
# Default: 1m
timeout: 3m
build-tags:
- example

# This file contains only configs which differ from defaults.
# All possible options can be found here https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml
Expand Down Expand Up @@ -274,5 +276,8 @@ issues:

# specific to pt
- path: "_test\\.go"
linters:
- gocognit
linters: [ gocognit ]
- path: "example_test\\.go"
linters: [ testpackage ]
- path: "example\\.go"
linters: [ gomnd ]
7 changes: 4 additions & 3 deletions example/example.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
//go:build example
// +build example

package example

func sum(numbers ...int) int {
sum := 0
s := 0
for _, n := range numbers {
sum += n
s += n
}
return sum
return s
}

func fibonacci(n uint64) uint64 {
Expand Down
1 change: 1 addition & 0 deletions example/example_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build example
// +build example

package example
Expand Down
3 changes: 1 addition & 2 deletions pt.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ func Test(name string, test func(t *testing.T)) testing.InternalTest {

// alreadyParallel returns value of private field isParallel for provided t *testing.T.
func alreadyParallel(t *testing.T) bool {
// copy of mutex is not used, so can ignore govet error
testObject := reflect.ValueOf(*t) //nolint:govet // here it's ok to copy lock value
testObject := reflect.ValueOf(t).Elem()
isParallelField := testObject.FieldByName("isParallel")
isParallel := isParallelField.Bool()
return isParallel
Expand Down

0 comments on commit 4f2c3ee

Please sign in to comment.