func lookupTagNames(store *storage.Storage, fileTags entities.FileTags) ([]string, error) { tagNames := make([]string, 0, len(fileTags)) for _, fileTag := range fileTags { tag, err := store.Tag(fileTag.TagId) if err != nil { return nil, fmt.Errorf("could not lookup tag: %v", err) } if tag == nil { return nil, fmt.Errorf("tag '%v' does not exist", fileTag.TagId) } var tagName string if fileTag.ValueId == 0 { tagName = tag.Name } else { value, err := store.Value(fileTag.ValueId) if err != nil { return nil, fmt.Errorf("could not lookup value: %v", err) } if value == nil { return nil, fmt.Errorf("value '%v' does not exist", fileTag.ValueId) } tagName = tag.Name + "=" + value.Name } tagNames = append(tagNames, tagName) } sort.Strings(tagNames) return tagNames, nil }