a41f938cec
As we have seen, dependencies version can prevent the build. We should user lock versions on dependencies that we know work: * Packages are vendored * Add Godep support * Added addtional install step in readme * Fix travis build error
25 lignes
374 o
Go
25 lignes
374 o
Go
package missinggo
|
|
|
|
import (
|
|
"strconv"
|
|
"strings"
|
|
"unicode"
|
|
)
|
|
|
|
func StringTruth(s string) (ret bool) {
|
|
s = strings.TrimFunc(s, func(r rune) bool {
|
|
return r == 0 || unicode.IsSpace(r)
|
|
})
|
|
if s == "" {
|
|
return false
|
|
}
|
|
ret, err := strconv.ParseBool(s)
|
|
if err == nil {
|
|
return
|
|
}
|
|
i, err := strconv.ParseInt(s, 0, 0)
|
|
if err == nil {
|
|
return i != 0
|
|
}
|
|
return true
|
|
}
|