Update golangci-lint configuration

This commit is contained in:
世界 2024-08-18 11:14:54 +08:00
parent e33b1d67d5
commit ec1df651e8
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
4 changed files with 19 additions and 1 deletions

View file

@ -5,6 +5,12 @@ linters:
- govet - govet
- gci - gci
- staticcheck - staticcheck
- paralleltest
- ineffassign
linters-settings: linters-settings:
gci: gci:
@ -13,3 +19,10 @@ linters-settings:
- standard - standard
- prefix(github.com/sagernet/) - prefix(github.com/sagernet/)
- default - default
staticcheck:
checks:
- all
- -SA1003
run:
go: "1.23"

View file

@ -36,7 +36,7 @@ func TCPPipe(t *testing.T) (net.Conn, net.Conn) {
clientConn, clientErr = net.Dial("tcp", listener.Addr().String()) clientConn, clientErr = net.Dial("tcp", listener.Addr().String())
return clientErr return clientErr
}) })
err = group.Run() err = group.Run(context.Background())
require.NoError(t, err) require.NoError(t, err)
listener.Close() listener.Close()
t.Cleanup(func() { t.Cleanup(func() {

View file

@ -6,6 +6,7 @@ import (
) )
func TestRevertRanges(t *testing.T) { func TestRevertRanges(t *testing.T) {
t.Parallel()
for _, testRange := range []struct { for _, testRange := range []struct {
start, end int start, end int
ranges []Range[int] ranges []Range[int]
@ -77,6 +78,7 @@ func TestRevertRanges(t *testing.T) {
} }
func TestMergeRanges(t *testing.T) { func TestMergeRanges(t *testing.T) {
t.Parallel()
for _, testRange := range []struct { for _, testRange := range []struct {
ranges []Range[int] ranges []Range[int]
expected []Range[int] expected []Range[int]
@ -144,6 +146,7 @@ func TestMergeRanges(t *testing.T) {
} }
func TestExcludeRanges(t *testing.T) { func TestExcludeRanges(t *testing.T) {
t.Parallel()
for _, testRange := range []struct { for _, testRange := range []struct {
ranges []Range[int] ranges []Range[int]
exclude []Range[int] exclude []Range[int]

View file

@ -9,6 +9,7 @@ import (
) )
func TestSlicesValue(t *testing.T) { func TestSlicesValue(t *testing.T) {
t.Parallel()
int64Arr := make([]int64, 64) int64Arr := make([]int64, 64)
for i := range int64Arr { for i := range int64Arr {
int64Arr[i] = rand.Int63() int64Arr[i] = rand.Int63()
@ -18,6 +19,7 @@ func TestSlicesValue(t *testing.T) {
} }
func TestSetSliceValue(t *testing.T) { func TestSetSliceValue(t *testing.T) {
t.Parallel()
int64Arr := make([]int64, 64) int64Arr := make([]int64, 64)
value := reflect.Indirect(reflect.ValueOf(&int64Arr)) value := reflect.Indirect(reflect.ValueOf(&int64Arr))
newInt64Arr := make([]int64, 64) newInt64Arr := make([]int64, 64)