Stop abusing pointers for Atom generation

This commit is contained in:
blank X 2021-08-11 17:10:44 +07:00
parent 672c6e67ec
commit 4d0ce85b42
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 8 additions and 8 deletions

16
main.go
View File

@ -314,9 +314,9 @@ func main() {
}
gemini.ParseLines(resp.Body, aw.Handle)
sort.Sort(ByTime(aw.Items))
feed := &Feed{
feed := Feed{
XMLNS: "http://www.w3.org/2005/Atom",
Link: &FeedLink{
Link: FeedLink{
Href: req.URL.String(),
},
Id: req.URL.String(),
@ -338,9 +338,9 @@ func main() {
if err != nil {
log.Fatal(err)
}
feed.Entries = append(feed.Entries, &FeedEntry{
feed.Entries = append(feed.Entries, FeedEntry{
Title: item.Title,
Link: &EntryLink{
Link: EntryLink{
Href: link.String(),
Rel: "alternate",
},
@ -359,10 +359,10 @@ type Feed struct {
XMLName xml.Name `xml:"feed"`
XMLNS string `xml:"xmlns,attr"`
Title string `xml:"title"`
Link *FeedLink `xml:"link"`
Link FeedLink `xml:"link"`
Updated string `xml:"updated"`
Id string `xml:"id"`
Entries []*FeedEntry `xml:"entry"`
Entries []FeedEntry `xml:"entry"`
}
type FeedLink struct {
XMLName xml.Name `xml:"link"`
@ -371,14 +371,14 @@ type FeedLink struct {
type FeedEntry struct {
XMLName xml.Name `xml:"entry"`
Title string `xml:"title"`
Link *EntryLink `xml:"link"`
Link EntryLink `xml:"link"`
Id string `xml:"id"`
Updated string `xml:"updated"`
}
type EntryLink struct {
XMLName xml.Name `xml:"link"`
Href string `xml:"href,attr"`
Rel string `xml:"rel,attr"`
Rel string `xml:"rel,attr"`
}
type FeedItem struct {