diff --git a/main.go b/main.go index 7d8be2d..d2d550a 100644 --- a/main.go +++ b/main.go @@ -1,12 +1,14 @@ package main import ( + "crypto/sha512" + "encoding/hex" "encoding/json" "fmt" "html/template" - "crypto/sha512" "io" "io/ioutil" + "mime" "net/http" "os" "os/exec" @@ -15,13 +17,11 @@ import ( "strings" "sync" "time" - "encoding/hex" - "mime" + "github.com/google/uuid" + "github.com/gorilla/feeds" "github.com/labstack/echo" "github.com/labstack/echo/middleware" - "github.com/gorilla/feeds" - "github.com/google/uuid" //"github.com/labstack/echo/middleware" ) @@ -36,7 +36,7 @@ type ( } Entry struct { - Date JSTime `json:"date"` + Date JSTime `json:"date"` Description string `json:"description"` Post string `json:"post"` Likes int `json:"likes"` @@ -146,9 +146,6 @@ func (list *entryMap) write() (err error) { if err == nil { err = ioutil.WriteFile(list.filename, data, 0644) } - if err == nil { - list.modtime = time.Now() - } return } @@ -162,7 +159,7 @@ func (list *entryMap) read() (err error) { // sort list list.sorted = make([]*Entry, 0, len(list.mapped)) - for _, entry:= range list.mapped { + for _, entry := range list.mapped { list.sorted = append(list.sorted, entry) } sort.Sort(entryList(list.sorted)) @@ -239,20 +236,20 @@ func (list *entryMap) getEntry(uuid string) (result *Entry, err error) { } func (list *entryMap) getFeed() (feed *feeds.Feed) { - feed = &feeds.Feed { - Title: "danoloan.es igar", - Link: &feeds.Link { Href: "https://danoloan.es/igar/" }, + feed = &feeds.Feed{ + Title: "danoloan.es igar", + Link: &feeds.Link{Href: "https://danoloan.es/igar/"}, Description: "bitácora fotográfica de danoloan", - Author: &feeds.Author { Name: "danoloan", Email: "danolo@danoloan.es" }, + Author: &feeds.Author{Name: "danoloan", Email: "danolo@danoloan.es"}, } feed.Items = make([]*feeds.Item, 0, list.Len()) for _, elem := range list.getSortedEntries() { - item := &feeds.Item { - Title: elem.Description, - Link: &feeds.Link{ Href: fmt.Sprintf("https://danoloan.es/igar/view?uuid=%s", elem.Post) }, + item := &feeds.Item{ + Title: elem.Description, + Link: &feeds.Link{Href: fmt.Sprintf("https://danoloan.es/igar/view?uuid=%s", elem.Post)}, Description: fmt.Sprintf("
%s
\n