Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save titpetric/a331f8b647fa462a5cd0126963918c75 to your computer and use it in GitHub Desktop.
Save titpetric/a331f8b647fa462a5cd0126963918c75 to your computer and use it in GitHub Desktop.
func parse(input io.Reader) (p *point, err error) {
// handle read errors
read := func(data interface{}) {
if err == nil {
err = binary.Read(input, binary.BigEndian, data)
}
}
p := &point{}
read(&p.Longitude)
read(&p.Latitude)
read(&p.Distance)
read(&p.ElevationGain)
read(&p.ElevationLoss)
if r.err != nil {
p = nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment