diff --git a/cmd/add.go b/cmd/add.go index 4270109..d5de862 100644 --- a/cmd/add.go +++ b/cmd/add.go @@ -104,9 +104,11 @@ func parseGrepLine(line string) (*model.Ticket, error) { text := strings.Join(parts[2:], "") return &model.Ticket{ - "filename": filename, - "lineNo": lineNo, - "text": text, + Data: map[string]interface{}{ + "filename": filename, + "lineNo": lineNo, + "text": text, + }, }, nil } diff --git a/model/ticket.go b/model/ticket.go index 974dedd..6e9aed4 100644 --- a/model/ticket.go +++ b/model/ticket.go @@ -4,13 +4,17 @@ import ( "fmt" ) -type Ticket map[string]interface{} +type Ticket struct { + GithubLink string `json:"githubLink,omitempty"` + JiraLink string `json:"jiraLink,omitempty"` + Data map[string]interface{} `json:"data,omitempty"` +} func RemoveDuplicateTickets(tickets []*Ticket, fileOnly bool) []*Ticket { ticketMap := map[string]*Ticket{} for _, t := range tickets { - filename, _ := (*t)["filename"].(string) - lineNo, _ := (*t)["lineNo"].(int) + filename, _ := t.Data["filename"].(string) + lineNo, _ := t.Data["lineNo"].(int) if fileOnly { ticketMap[filename] = t } else {