From aabe0407eeee523a92a3f2ebb3ae5b8c2fddfc6c Mon Sep 17 00:00:00 2001 From: Pawel Zak Date: Sat, 5 Oct 2024 15:18:55 +0200 Subject: [PATCH] chore(linters): Enable `datarace` rule for revive --- .golangci.yml | 1 + plugins/common/shim/goshim_test.go | 6 +++--- plugins/common/shim/input_test.go | 6 +++--- plugins/inputs/execd/shim/shim_test.go | 6 +++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index e5a4f7c95c14f..1bdb01fa73dd8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -254,6 +254,7 @@ linters-settings: - name: constant-logical-expr - name: context-as-argument - name: context-keys-type + - name: datarace - name: deep-exit - name: defer - name: dot-imports diff --git a/plugins/common/shim/goshim_test.go b/plugins/common/shim/goshim_test.go index b123cc5addbcb..e4b5f498d3a40 100644 --- a/plugins/common/shim/goshim_test.go +++ b/plugins/common/shim/goshim_test.go @@ -31,9 +31,9 @@ func TestShimSetsUpLogger(t *testing.T) { require.NoError(t, err) } -func runErroringInputPlugin(t *testing.T, interval time.Duration, stdin io.Reader, stdout, stderr io.Writer) (metricProcessed chan bool, exited chan bool) { - metricProcessed = make(chan bool, 1) - exited = make(chan bool, 1) +func runErroringInputPlugin(t *testing.T, interval time.Duration, stdin io.Reader, stdout, stderr io.Writer) (chan bool, chan bool) { + metricProcessed := make(chan bool, 1) + exited := make(chan bool, 1) inp := &erroringInput{} shim := New() diff --git a/plugins/common/shim/input_test.go b/plugins/common/shim/input_test.go index 0233c7d8f896a..9260dbc6d6f6a 100644 --- a/plugins/common/shim/input_test.go +++ b/plugins/common/shim/input_test.go @@ -54,9 +54,9 @@ func TestInputShimStdinSignalingWorks(t *testing.T) { <-exited } -func runInputPlugin(t *testing.T, interval time.Duration, stdin io.Reader, stdout, stderr io.Writer) (metricProcessed chan bool, exited chan bool) { - metricProcessed = make(chan bool, 1) - exited = make(chan bool, 1) +func runInputPlugin(t *testing.T, interval time.Duration, stdin io.Reader, stdout, stderr io.Writer) (chan bool, chan bool) { + metricProcessed := make(chan bool, 1) + exited := make(chan bool, 1) inp := &testInput{ metricProcessed: metricProcessed, } diff --git a/plugins/inputs/execd/shim/shim_test.go b/plugins/inputs/execd/shim/shim_test.go index 33aa87f6ec4ea..f6bf0a2927a42 100644 --- a/plugins/inputs/execd/shim/shim_test.go +++ b/plugins/inputs/execd/shim/shim_test.go @@ -53,9 +53,9 @@ func TestShimStdinSignalingWorks(t *testing.T) { <-exited } -func runInputPlugin(t *testing.T, interval time.Duration, stdin io.Reader, stdout, stderr io.Writer) (metricProcessed, exited chan bool) { - metricProcessed = make(chan bool) - exited = make(chan bool) +func runInputPlugin(t *testing.T, interval time.Duration, stdin io.Reader, stdout, stderr io.Writer) (chan bool, chan bool) { + metricProcessed := make(chan bool) + exited := make(chan bool) inp := &testInput{ metricProcessed: metricProcessed, }