Skip to content

Commit

Permalink
fix: incorrect conversion between integer types (#500)
Browse files Browse the repository at this point in the history
Issue flagged by CodeQL.

- Closes #499
  • Loading branch information
jharley authored Jul 17, 2024
1 parent b9814af commit 3ecd18f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion honeycombio/type_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func coerceValueToType(i string) interface{} {

// Plugin SDK assumes 64bit so we'll do the same
if v, err := strconv.ParseInt(i, 10, 64); err == nil {
return int(v)
return v
} else if v, err := strconv.ParseFloat(i, 64); err == nil {
return v
} else if v, err := strconv.ParseBool(i); err == nil {
Expand Down
4 changes: 2 additions & 2 deletions honeycombio/type_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ func Test_coerceValueToType(t *testing.T) {
{
name: "int",
input: "300",
expected: 300,
expected: int64(300),
},
{
name: "zero",
input: "0",
expected: 0,
expected: int64(0),
},
{
name: "stringy number",
Expand Down

0 comments on commit 3ecd18f

Please sign in to comment.