diff options
-rw-r--r-- | go.mod | 5 | ||||
-rw-r--r-- | go.sum | 4 | ||||
-rw-r--r-- | myCovidCLI.go | 27 |
3 files changed, 25 insertions, 11 deletions
diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..50cf929 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module git.tilde.institute/kneezle/myCovidCLI + +go 1.13 + +require github.com/olekukonko/tablewriter v0.0.4 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..99b40fc --- /dev/null +++ b/go.sum @@ -0,0 +1,4 @@ +github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54= +github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/olekukonko/tablewriter v0.0.4 h1:vHD/YYe1Wolo78koG299f7V/VAS08c6IpCLn+Ejf/w8= +github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= diff --git a/myCovidCLI.go b/myCovidCLI.go index fbd06db..2594512 100644 --- a/myCovidCLI.go +++ b/myCovidCLI.go @@ -12,14 +12,16 @@ import ( "strings" "time" + "git.tilde.institute/kneezle/myCOVIDcli/renderfloat" "github.com/olekukonko/tablewriter" - "myCOVIDcli/renderfloat" ) func main() { + var bodydata string + maxloops := 3 currentTime := time.Now() //get current time/date - bodydata := "" + for i := 0; i < maxloops; i++ { strcurrentdate := currentTime.Format("01-02-2006") //reformat for URL format @@ -47,15 +49,18 @@ func main() { //fmt.Println(bodydata) reader := csv.NewReader(strings.NewReader(bodydata)) - //zero out all variables - usconfirmed := 0 - usdeaths := 0 - usrecovered := 0 - region := "" - state := "" - confirmed := "" - deaths := "" - recovered := "" + // Initialize variables. + var ( + usconfirmed, + usdeaths, + usrecovered int + + region, + state, + confirmed, + deaths, + recovered string + ) data := [][]string{} for { |