Skip to content

Commit

Permalink
fix: code scanning alert no. 2: Incorrect conversion between integer …
Browse files Browse the repository at this point in the history
…types

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
TBXark and github-advanced-security[bot] authored Dec 2, 2024
1 parent cd0c0c2 commit 1e8745c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/utils/idgenerator/idgenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (

func init() {
workerIDRaw := os.Getenv("WORKER_ID")
workerID, _ := strconv.Atoi(workerIDRaw)
if workerID == 0 {
workerIDRaw := os.Getenv("WORKER_ID")
workerID, err := strconv.ParseUint(workerIDRaw, 10, 16)
if err != nil || workerID == 0 {
workerID = 1
}
options := idgen.NewIdGeneratorOptions(uint16(workerID))
Expand Down

0 comments on commit 1e8745c

Please sign in to comment.