From e20f3da62efa7ca687cbba0378ce066174712e81 Mon Sep 17 00:00:00 2001 From: Diana Devasia Date: Mon, 11 Mar 2024 20:04:34 -0400 Subject: [PATCH] Adding the comment to ignore like in tests as its started to scan these errors --- toxics/latency.go | 2 +- toxics/slicer.go | 4 ++-- toxics/toxic.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/toxics/latency.go b/toxics/latency.go index a56370af..857c292a 100644 --- a/toxics/latency.go +++ b/toxics/latency.go @@ -21,7 +21,7 @@ func (t *LatencyToxic) delay() time.Duration { delay := t.Latency jitter := t.Jitter if jitter > 0 { - //#nosec + // #nosec G404 -- was ignored before too delay += rand.Int63n(jitter*2) - jitter } return time.Duration(delay) * time.Millisecond diff --git a/toxics/slicer.go b/toxics/slicer.go index f35dfd54..1ba2a27d 100644 --- a/toxics/slicer.go +++ b/toxics/slicer.go @@ -38,9 +38,9 @@ func (t *SlicerToxic) chunk(start int, end int) []int { } mid := start + (end-start)/2 - //#nosec + if t.SizeVariation > 0 { - mid += rand.Intn(t.SizeVariation*2) - t.SizeVariation + mid += rand.Intn(t.SizeVariation*2) - t.SizeVariation // #nosec G404 -- was ignored before too } left := t.chunk(start, mid) right := t.chunk(mid, end) diff --git a/toxics/toxic.go b/toxics/toxic.go index 058c60d9..df4d6716 100644 --- a/toxics/toxic.go +++ b/toxics/toxic.go @@ -81,8 +81,8 @@ func NewToxicStub(input <-chan *stream.StreamChunk, output chan<- *stream.Stream func (s *ToxicStub) Run(toxic *ToxicWrapper) { s.running = make(chan struct{}) defer close(s.running) - //#nosec - if rand.Float32() < toxic.Toxicity { + randomToxicity := rand.Float32() // #nosec G404 -- was ignored before too + if randomToxicity < toxic.Toxicity { toxic.Pipe(s) } else { new(NoopToxic).Pipe(s)