From 528c1c0a876c0a21b322a82780d093216a4e06b9 Mon Sep 17 00:00:00 2001 From: Tai Groot Date: Sun, 19 Jun 2022 16:24:54 -0600 Subject: [PATCH] add NewDataSet call --- bin/gitfetch/gitfetch.go | 4 +--- gico.go | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/gitfetch/gitfetch.go b/bin/gitfetch/gitfetch.go index e59cd67..a5e436f 100644 --- a/bin/gitfetch/gitfetch.go +++ b/bin/gitfetch/gitfetch.go @@ -11,8 +11,6 @@ import ( gterm "github.com/taigrr/gitgraph/term" ) -type DataSet map[time.Time]gico.WorkDay - func main() { r, err := git.PlainOpenWithOptions(".", &(git.PlainOpenOptions{DetectDotGit: true})) @@ -26,7 +24,7 @@ func main() { // year := time.Now().Year() // yearStart := time.Time{} // yearStart.AddDate(year, 0, 0) - data := make(DataSet) + data := gico.NewDataSet() err = cIter.ForEach(func(c *object.Commit) error { ts := c.Author.When commit := gico.Commit{Author: c.Author.Name, Message: c.Message, TimeStamp: ts} diff --git a/gico.go b/gico.go index 6598d70..1d8ac13 100644 --- a/gico.go +++ b/gico.go @@ -50,6 +50,10 @@ type Commit struct { type DataSet map[time.Time]WorkDay +func NewDataSet() DataSet { + return make(DataSet) +} + type WorkDay struct { Day time.Time `json:"day"` Count int `json:"count"`