/gocal

ICS file parser in Golang

Primary LanguageGo

gocal

Fast (and opinionated) ICAL parser in Golang.

Gocal takes an io.Reader and produces an array of Events from it.

Usage

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)
  }
}

Limitations

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:

  • UID
  • SUMMARY / DESCRIPTION
  • DTSTART / DTEND (day-long, local, UTC and TZIDd)
  • DTSTAMP / CREATED / LAST-MODIFIED
  • LOCATION
  • STATUS
  • ORGANIZER (CN; DIR and value)
  • ATTENDEEs (CN, DIR, PARTSTAT and value)
  • ATTACH (FILENAME, ENCODING, VALUE, FMTTYPE and value)
  • CATEGORIES
  • GEO

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.