Skip to content

Commit

Permalink
Fixes linting
Browse files Browse the repository at this point in the history
  • Loading branch information
richmahn committed Nov 2, 2022
1 parent 33dce71 commit 524d508
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/convert/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,21 @@ func ToCatalogEntry(dm *models.Door43Metadata, mode perm.AccessMode) *api.Catalo

var books []string
if val, ok := (*dm.Metadata)["books"]; ok {
// Marshal/Unmarshal to let Unmarshaliing convert interface{} to []string
if byteData, err := json.Marshal(val); err == nil {
json.Unmarshal(byteData, &books)
if err := json.Unmarshal(byteData, &books); err != nil {
log.Error("Unable to Unmarshal books: %v\n", val)
}
}
}

var alignmentCounts map[string]int64
if val, ok := (*dm.Metadata)["alignment_counts"]; ok {
// Marshal/Unmarshal to let Unmarshaliing convert interface{} to map[string]int64
if byteData, err := json.Marshal(val); err == nil {
json.Unmarshal(byteData, &alignmentCounts)
if err := json.Unmarshal(byteData, &alignmentCounts); err != nil {
log.Error("Unable to Unmarshal alignment_counts: %v\n", val)
}
}
}

Expand Down

0 comments on commit 524d508

Please sign in to comment.