From ec1df651e8f2359c93332126e254445b282efd79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sun, 18 Aug 2024 11:14:54 +0800 Subject: [PATCH] Update golangci-lint configuration --- .golangci.yml | 13 +++++++++++++ common/bufio/net_test.go | 2 +- common/ranges/range_test.go | 3 +++ common/varbin/value_slices_unsafe_test.go | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 5f1dcd0..13a8575 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,6 +5,12 @@ linters: - govet - gci - staticcheck + - paralleltest + - ineffassign + + + + linters-settings: gci: @@ -13,3 +19,10 @@ linters-settings: - standard - prefix(github.com/sagernet/) - default + staticcheck: + checks: + - all + - -SA1003 + +run: + go: "1.23" \ No newline at end of file diff --git a/common/bufio/net_test.go b/common/bufio/net_test.go index 8642572..cee5c54 100644 --- a/common/bufio/net_test.go +++ b/common/bufio/net_test.go @@ -36,7 +36,7 @@ func TCPPipe(t *testing.T) (net.Conn, net.Conn) { clientConn, clientErr = net.Dial("tcp", listener.Addr().String()) return clientErr }) - err = group.Run() + err = group.Run(context.Background()) require.NoError(t, err) listener.Close() t.Cleanup(func() { diff --git a/common/ranges/range_test.go b/common/ranges/range_test.go index d4dad35..0d6f5f3 100644 --- a/common/ranges/range_test.go +++ b/common/ranges/range_test.go @@ -6,6 +6,7 @@ import ( ) func TestRevertRanges(t *testing.T) { + t.Parallel() for _, testRange := range []struct { start, end int ranges []Range[int] @@ -77,6 +78,7 @@ func TestRevertRanges(t *testing.T) { } func TestMergeRanges(t *testing.T) { + t.Parallel() for _, testRange := range []struct { ranges []Range[int] expected []Range[int] @@ -144,6 +146,7 @@ func TestMergeRanges(t *testing.T) { } func TestExcludeRanges(t *testing.T) { + t.Parallel() for _, testRange := range []struct { ranges []Range[int] exclude []Range[int] diff --git a/common/varbin/value_slices_unsafe_test.go b/common/varbin/value_slices_unsafe_test.go index ed876a4..8ebec99 100644 --- a/common/varbin/value_slices_unsafe_test.go +++ b/common/varbin/value_slices_unsafe_test.go @@ -9,6 +9,7 @@ import ( ) func TestSlicesValue(t *testing.T) { + t.Parallel() int64Arr := make([]int64, 64) for i := range int64Arr { int64Arr[i] = rand.Int63() @@ -18,6 +19,7 @@ func TestSlicesValue(t *testing.T) { } func TestSetSliceValue(t *testing.T) { + t.Parallel() int64Arr := make([]int64, 64) value := reflect.Indirect(reflect.ValueOf(&int64Arr)) newInt64Arr := make([]int64, 64)