Skip to content

Commit fed51b5

Browse files
dependabot[bot]ldez
authored andcommitted
build(deps): bump github.com/maratori/testpackage from 1.0.1 to 1.1.0 (golangci#2945)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
1 parent 8de9783 commit fed51b5

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

.golangci.reference.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,6 +1632,11 @@ linters-settings:
16321632
# Regexp pattern to skip files.
16331633
# Default: "(export|internal)_test\\.go"
16341634
skip-regexp: (export|internal)_test\.go
1635+
# List of packages that don't end with _test that tests are allowed to be in.
1636+
# Default: "main"
1637+
allow-packages:
1638+
- example
1639+
- main
16351640

16361641
thelper:
16371642
test:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ require (
5555
github.com/ldez/tagliatelle v0.3.1
5656
github.com/leonklingele/grouper v1.1.0
5757
github.com/lufeee/execinquery v1.2.1
58-
github.com/maratori/testpackage v1.0.1
58+
github.com/maratori/testpackage v1.1.0
5959
github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // v1.0
6060
github.com/mattn/go-colorable v0.1.12
6161
github.com/mbilski/exhaustivestruct v1.2.0

go.sum

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/config/linters_settings.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ var defaultLintersSettings = LintersSettings{
8888
Qualified: false,
8989
},
9090
Testpackage: TestpackageSettings{
91-
SkipRegexp: `(export|internal)_test\.go`,
91+
SkipRegexp: `(export|internal)_test\.go`,
92+
AllowPackages: []string{"main"},
9293
},
9394
Unparam: UnparamSettings{
9495
Algo: "cha",
@@ -558,7 +559,8 @@ type TagliatelleSettings struct {
558559
}
559560

560561
type TestpackageSettings struct {
561-
SkipRegexp string `mapstructure:"skip-regexp"`
562+
SkipRegexp string `mapstructure:"skip-regexp"`
563+
AllowPackages []string `mapstructure:"allow-packages"`
562564
}
563565

564566
type ThelperSettings struct {

pkg/golinters/testpackage.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package golinters
22

33
import (
4+
"strings"
5+
46
"github.com/maratori/testpackage/pkg/testpackage"
57
"golang.org/x/tools/go/analysis"
68

@@ -15,7 +17,8 @@ func NewTestpackage(cfg *config.TestpackageSettings) *goanalysis.Linter {
1517
if cfg != nil {
1618
settings = map[string]map[string]interface{}{
1719
a.Name: {
18-
testpackage.SkipRegexpFlagName: cfg.SkipRegexp,
20+
testpackage.SkipRegexpFlagName: cfg.SkipRegexp,
21+
testpackage.AllowPackagesFlagName: strings.Join(cfg.AllowPackages, ","),
1922
},
2023
}
2124
}

0 commit comments

Comments
 (0)