You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**testpackage** is a golang linter that makes you use a separate `_test` package.
4
4
@@ -23,11 +23,10 @@ More detailed articles on this topic:
23
23
24
24
## Usage
25
25
26
-
The best way is to use [golangci-lint](https://github.com/golangci/golangci-lint).
27
-
It includes **testpackage** linter started from v1.25.0 and higher.
26
+
The best way is to use [golangci-lint](https://golangci-lint.run/). It includes [testpackage](https://golangci-lint.run/usage/linters/#list-item-testpackage) and a lot of other great linters.
28
27
29
28
### Install
30
-
See [install section](https://github.com/golangci/golangci-lint#install) of readme.
29
+
See [official site](https://golangci-lint.run/usage/install/).
31
30
32
31
### Configuration
33
32
**testpackage** is disabled by default. To enable it, add the following to your `.golangci.yml`:
@@ -45,15 +44,15 @@ Here are the default values:
45
44
linters-settings:
46
45
testpackage:
47
46
skip-regexp: (export|internal)_test\.go
48
-
allow-packages: main
47
+
allow-packages:
48
+
- main
49
49
```
50
50
51
51
### Run
52
52
```shell script
53
53
golangci-lint run
54
54
```
55
55
56
-
57
56
## Usage as standalone linter
58
57
59
58
### Install
@@ -84,7 +83,7 @@ Flags:
84
83
-skip-regexp string
85
84
regexp pattern to skip file by name. To not skip files use -skip-regexp="^$" (default "(export|internal)_test\\.go")
86
85
-allow-packages string
87
-
comma separated list of packages that don't end with _test that tests are allowed to be in
86
+
comma separated list of packages that don't end with _test that tests are allowed to be in (default "main")
88
87
-V print version and exit
89
88
-c int
90
89
display offending line with this many lines of context (default -1)
@@ -100,13 +99,26 @@ Flags:
100
99
emit JSON output
101
100
-memprofile string
102
101
write memory profile to this file
102
+
-test
103
+
indicates whether test files should be analyzed, too (default true)
103
104
-trace string
104
105
write trace log to this file
105
106
```
106
107
108
+
## Contributors
109
+
*[maratori](https://github.com/maratori)
110
+
*[G-Rath](https://github.com/G-Rath)
107
111
108
112
## Changelog
109
113
114
+
### [v1.1.0] - 2022-06-22
115
+
116
+
#### Changed
117
+
* Allow tests in `main` package by default and add flag `-allow-packages` to allow tests without `_test` suffix (thanks [G-Rath](https://github.com/G-Rath))
118
+
* Update golang to 1.18
119
+
* Migrate to [github actions](https://github.com/maratori/testpackage/actions/workflows/ci.yaml) from travis-ci
0 commit comments