Created
May 9, 2017 20:39
-
-
Save titpetric/a331f8b647fa462a5cd0126963918c75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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