Fast (and opinionated) ICAL parser in Golang.
Gocal takes an io.Reader and produces an array of Events from it.
package main
func main() {
f, _ := os.Open("/tmp/mycalendar.ics")
defer f.Close()
c := gocal.NewParser(f)
c.Parse()
for _, e := range c.Events {
fmt.Printf("%s on %s by %s", e.Summary, e.Start, e.Organizer.Cn)
}
}I do not pretend this abides by RFC 5545, this only covers parts I needed to be parsed for my own personal use. Among other, most propery parameters are not handled by the library, and, for now, only the following properties are parsed:
UIDSUMMARY/DESCRIPTIONDTSTART/DTEND(day-long, local, UTC andTZIDd)DTSTAMP/CREATED/LAST-MODIFIEDLOCATIONSTATUSORGANIZER(CN;DIRand value)ATTENDEEs (CN,DIR,PARTSTATand value)ATTACH(FILENAME,ENCODING,VALUE,FMTTYPEand value)CATEGORIESGEO
And I do not (for now) try and parse RRULEs, so recurring events will show
as a single event.
Also, we ignore whatever's not a VEVENT.