diff options
author | CodeCarefully <CodeCarefully@users.noreply.github.com> | 2020-05-28 12:32:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-28 12:32:02 +0300 |
commit | 01a918775e5045f361cb9c15b4430b2f552604fa (patch) | |
tree | 7c893b6c0417cd5145f0a1b5c1ca84f6637121a3 | |
parent | a2e5a922ae60fa4a3db7319bc3d01385966fcb34 (diff) | |
parent | dd552f65b60da7f7fd76723efced0ee6fd61b337 (diff) | |
download | myCovidCLI-01a918775e5045f361cb9c15b4430b2f552604fa.tar.gz |
Merge pull request #3 from andinus/andinus-main
Use go modules & initialize variables properly
-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 { |