handle int64

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-06 20:55:21 -07:00
parent 93d3e13acc
commit a12da586e9
2 changed files with 13 additions and 7 deletions

View File

@ -61,15 +61,11 @@ func Chomp(a interface{}) string {
return perlChomp(s)
case uint64:
log.Printf("shell.Chomp() FOUND []uint64")
var tmp uint64
tmp = a.(uint64)
s := string(tmp)
s := fmt.Sprintf("%d", a.(uint64))
return perlChomp(s)
case int64:
log.Printf("shell.Chomp() FOUND []uint64")
var tmp int64
tmp = a.(int64)
s := string(tmp)
log.Printf("shell.Chomp() FOUND []int64")
s := fmt.Sprintf("%d", a.(int64))
return perlChomp(s)
case *bytes.Buffer:
log.Printf("shell.Chomp() FOUND *bytes.Buffer")

10
int.go
View File

@ -19,3 +19,13 @@ func Int(s string) int {
}
return i
}
func Int64(s string) int64 {
s = Chomp(s)
i, err := strconv.Atoi(s)
if (err != nil) {
handleError(err, -1)
return 0
}
return int64(i)
}