Skip to content

Commit

Permalink
fix: replace some strconv.Atoi with strconv.ParseInt for int32
Browse files Browse the repository at this point in the history
type saftey

Signed-off-by: Alexander Trost <[email protected]>
  • Loading branch information
galexrt committed Feb 4, 2025
1 parent 5d9a1e0 commit 6077c99
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions services/centrum/centrumstate/dispatches.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ func (s *State) ListDispatches(ctx context.Context, job string) ([]*centrum.Disp

// Remove broken dispatches
if dsp.Id == 0 || dsp.Job == "" {
dId, err := strconv.Atoi(id)
dispatchId, err := strconv.ParseInt(id, 10, 64)
if err != nil {
return ds, false
}

if err := s.DeleteDispatch(ctx, job, uint64(dId)); err != nil {
if err := s.DeleteDispatch(ctx, job, uint64(dispatchId)); err != nil {
return ds, false
}

Expand Down
2 changes: 1 addition & 1 deletion services/notificator/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (s *Server) Stream(req *pbnotificator.StreamRequest, srv pbnotificator.Noti
if len(parts) < 2 {
continue
}
grade, err := strconv.Atoi(parts[1])
grade, err := strconv.ParseInt(parts[1], 10, 32)
if err != nil {
continue
}
Expand Down

0 comments on commit 6077c99

Please sign in to comment.