From 7bf9e7c653b8a67bb9557e2c6b892d077ee704a3 Mon Sep 17 00:00:00 2001 From: iprotsiuk <42197193+iprotsiuk@users.noreply.github.com> Date: Wed, 4 Sep 2024 16:10:15 -0700 Subject: [PATCH] fix: ignore lint warnings for G115 (#540) Signed-off-by: Andrew Costa --- src/internal/gateway/gateway.go | 2 +- src/internal/routing/routing_table.go | 5 +++-- src/internal/routing/static_lookup.go | 2 +- src/internal/syslog/server.go | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/internal/gateway/gateway.go b/src/internal/gateway/gateway.go index a307e9a61..6be3282c2 100644 --- a/src/internal/gateway/gateway.go +++ b/src/internal/gateway/gateway.go @@ -187,7 +187,7 @@ func (g *Gateway) handleInfoEndpoint(w http.ResponseWriter, r *http.Request) { func uptimeInSeconds() int64 { hostStats, _ := host.Info() - return int64(hostStats.Uptime) + return int64(hostStats.Uptime) //#nosec G115 } type errorBody struct { diff --git a/src/internal/routing/routing_table.go b/src/internal/routing/routing_table.go index 9694d5158..26c5d764a 100644 --- a/src/internal/routing/routing_table.go +++ b/src/internal/routing/routing_table.go @@ -47,8 +47,9 @@ func (t *RoutingTable) Lookup(item string) []int { node := t.hasher.Hash(hashValue) var result []int - for n := 0; n < int(t.replicationFactor); n++ { - result = append(result, (node+n*int(t.replicationFactor))%len(t.addresses)) + var replicationFactor int = int(t.replicationFactor) //#nosec G115 + for n := 0; n < replicationFactor; n++ { + result = append(result, (node+n*replicationFactor)%len(t.addresses)) } for _, r := range t.table { if hashValue >= r.start && hashValue <= r.end { diff --git a/src/internal/routing/static_lookup.go b/src/internal/routing/static_lookup.go index bf456a905..49f2fd82e 100644 --- a/src/internal/routing/static_lookup.go +++ b/src/internal/routing/static_lookup.go @@ -39,5 +39,5 @@ func NewStaticLookup(numOfRoutes int, hasher func(string) uint64) *StaticLookup func (l *StaticLookup) Lookup(sourceID string) int { h := l.hash(sourceID) n, _ := l.t.Floor(h) - return int(n.Value.(uint64)) + return int(n.Value.(uint64)) //#nosec G115 } diff --git a/src/internal/syslog/server.go b/src/internal/syslog/server.go index 9d2a27f1f..713b29c8f 100644 --- a/src/internal/syslog/server.go +++ b/src/internal/syslog/server.go @@ -255,7 +255,7 @@ func (s *Server) convertMessage(env *loggregator_v2.Envelope, msg *rfc5424.Syslo env.Message = &loggregator_v2.Envelope_Log{ Log: &loggregator_v2.Log{ Payload: []byte(payload), - Type: s.typeFromPriority(int(*msg.Priority)), + Type: s.typeFromPriority(int(*msg.Priority)), //#nosec G115 }, }