Skip to content

Commit

Permalink
chore: enable gosec
Browse files Browse the repository at this point in the history
  • Loading branch information
nvloff-f3 committed Mar 6, 2024
1 parent f2844c1 commit fb57765
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ linters:
- gocritic
- forbidigo
- dupl
- gosec

linters-settings:
tagliatelle:
Expand Down
6 changes: 5 additions & 1 deletion internal/run/prom_push_gw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strings"
"sync"
"sync/atomic"
"time"

io_prometheus_client "github.com/prometheus/client_model/go"
"github.com/prometheus/common/expfmt"
Expand Down Expand Up @@ -84,7 +85,10 @@ func (f *FakePrometheus) ServeHTTP(response http.ResponseWriter, request *http.R

func (f *FakePrometheus) StartServer() {
f.metricFamilies = sync.Map{}
f.server = &http.Server{Addr: fmt.Sprintf("localhost:%d", f.Port)}
f.server = &http.Server{
Addr: fmt.Sprintf("localhost:%d", f.Port),
ReadHeaderTimeout: 1 * time.Second,
}
f.server.Handler = f
go func() {
if err := f.server.ListenAndServe(); err != nil {
Expand Down
1 change: 1 addition & 0 deletions internal/trigger/api/iteration_jitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func WithJitter(rate RateFunction, multiple float64) RateFunction {
return rate
}
return func(now time.Time) int {
//nolint:gosec // G404: Use of weak random number generator - doesn't need to be secure
variationFactor := 1 + (math.Cos(rand.Float64()*2*math.Pi))*multiple/100
requestedRate := float64(rate(now)) + balance
proposed := requestedRate * variationFactor
Expand Down

0 comments on commit fb57765

Please sign in to comment.