about summary refs log tree commit diff stats
path: root/myCovidCLI.go
diff options
context:
space:
mode:
authorCodeCarefully <CodeCarefully@users.noreply.github.com>2020-05-28 12:32:02 +0300
committerGitHub <noreply@github.com>2020-05-28 12:32:02 +0300
commit01a918775e5045f361cb9c15b4430b2f552604fa (patch)
tree7c893b6c0417cd5145f0a1b5c1ca84f6637121a3 /myCovidCLI.go
parenta2e5a922ae60fa4a3db7319bc3d01385966fcb34 (diff)
parentdd552f65b60da7f7fd76723efced0ee6fd61b337 (diff)
downloadmyCovidCLI-01a918775e5045f361cb9c15b4430b2f552604fa.tar.gz
Merge pull request #3 from andinus/andinus-main
Use go modules & initialize variables properly
Diffstat (limited to 'myCovidCLI.go')
-rw-r--r--myCovidCLI.go27
1 files changed, 16 insertions, 11 deletions
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 {