Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

Commit

Permalink
fix: re-order conversion of string to type
Browse files Browse the repository at this point in the history
reason 1 = true, 0 = false, hence int test comes first
  • Loading branch information
mainawycliffe committed Feb 10, 2020
1 parent 129107b commit 4e25252
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import (
// ParseStringToActualValue takes a string and converts the string the actual
// type of the string i.e. "true" => true
func ParseStringToActualValueType(input string) interface{} {
if v, err := strconv.ParseBool(input); err == nil {
if v, err := strconv.Atoi(input); err == nil {
return v
}
if v, err := strconv.Atoi(input); err == nil {
if v, err := strconv.ParseFloat(input, 64); err == nil {
return v
}
if v, err := strconv.Atoi(input); err == nil {
if v, err := strconv.ParseBool(input); err == nil {
return v
}
return input
Expand Down

0 comments on commit 4e25252

Please sign in to comment.