fix me being dumb

This commit is contained in:
lyx0 2021-10-17 21:49:28 +02:00
parent 69ac5c52ed
commit 719213b25e

View file

@ -4,7 +4,6 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"strconv"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
@ -22,11 +21,7 @@ func RandomNumber() string {
return string(responseData) return string(responseData)
} }
func Number(num string) string { func Number(number string) string {
number, err := strconv.Atoi(num)
if err != nil {
return "Given value is not a number."
} else {
response, err := http.Get(fmt.Sprint("http://numbersapi.com/" + string(number))) response, err := http.Get(fmt.Sprint("http://numbersapi.com/" + string(number)))
if err != nil { if err != nil {
log.Fatalln(err) log.Fatalln(err)
@ -37,5 +32,3 @@ func Number(num string) string {
} }
return string(responseData) return string(responseData)
} }
}