Skip to content

Commit

Permalink
fix: ignore lint warnings for G115 (#540)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Costa <andrew.costa@broadcom.com>
  • Loading branch information
iprotsiuk committed Sep 4, 2024
1 parent e3b8ca8 commit 7bf9e7c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/internal/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions src/internal/routing/routing_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/internal/routing/static_lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion src/internal/syslog/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
}

Expand Down

0 comments on commit 7bf9e7c

Please sign in to comment.