From 79fb7651013064065436a9e88c46bd6a535d596d Mon Sep 17 00:00:00 2001 From: Andinus Date: Thu, 28 May 2020 14:39:26 +0530 Subject: Initialize variables properly --- myCovidCLI.go | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/myCovidCLI.go b/myCovidCLI.go index fbd06db..aa49097 100644 --- a/myCovidCLI.go +++ b/myCovidCLI.go @@ -17,9 +17,11 @@ import ( ) 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 { -- cgit 1.4.1-2-gfad0 From dee647df144e284c1afdedfb497e3ee456b36acc Mon Sep 17 00:00:00 2001 From: Andinus Date: Thu, 28 May 2020 14:49:03 +0530 Subject: Add go.mod file --- go.mod | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 go.mod diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..f50afa0 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module git.tilde.institute/kneezle/myCovidCLI + +go 1.13 -- cgit 1.4.1-2-gfad0 From 8a52ddeecf08d7cabf880aadc0dac817a258159b Mon Sep 17 00:00:00 2001 From: Andinus Date: Thu, 28 May 2020 14:49:57 +0530 Subject: Update import path --- myCovidCLI.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/myCovidCLI.go b/myCovidCLI.go index aa49097..2594512 100644 --- a/myCovidCLI.go +++ b/myCovidCLI.go @@ -12,8 +12,8 @@ import ( "strings" "time" + "git.tilde.institute/kneezle/myCOVIDcli/renderfloat" "github.com/olekukonko/tablewriter" - "myCOVIDcli/renderfloat" ) func main() { -- cgit 1.4.1-2-gfad0 From dd552f65b60da7f7fd76723efced0ee6fd61b337 Mon Sep 17 00:00:00 2001 From: Andinus Date: Thu, 28 May 2020 14:51:33 +0530 Subject: Update go.mod & go.sum --- go.mod | 2 ++ go.sum | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 go.sum diff --git a/go.mod b/go.mod index f50afa0..50cf929 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +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= -- cgit 1.4.1-2-gfad0