1
0
Fork 0
mirror of https://github.com/Luzifer/gpxhydrant.git synced 2024-12-22 20:21:17 +00:00

Fix: Followed linter advice

This commit is contained in:
Knut Ahlers 2016-05-07 14:51:51 +02:00
parent 8a1341a462
commit 720ba1191d
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -31,7 +31,7 @@ var (
}{} }{}
version = "dev" version = "dev"
wrongGPXComment = errors.New("GPX comment does not match expected format") errWrongGPXComment = errors.New("GPX comment does not match expected format")
) )
type hydrant struct { type hydrant struct {
@ -59,7 +59,7 @@ type hydrant struct {
func parseWaypoint(in gpx.Waypoint) (*hydrant, error) { func parseWaypoint(in gpx.Waypoint) (*hydrant, error) {
infoRegex := regexp.MustCompile(`([SPLG])([UOWP])(\?|[0-9]{2,3})`) infoRegex := regexp.MustCompile(`([SPLG])([UOWP])(\?|[0-9]{2,3})`)
if !infoRegex.MatchString(in.Comment) { if !infoRegex.MatchString(in.Comment) {
return nil, wrongGPXComment return nil, errWrongGPXComment
} }
matches := infoRegex.FindStringSubmatch(in.Comment) matches := infoRegex.FindStringSubmatch(in.Comment)
@ -195,7 +195,7 @@ func main() {
for _, wp := range gpxData.Waypoints { for _, wp := range gpxData.Waypoints {
h, e := parseWaypoint(wp) h, e := parseWaypoint(wp)
if e != nil { if e != nil {
if cfg.Debug || e != wrongGPXComment { if cfg.Debug || e != errWrongGPXComment {
log.Printf("Found waypoint not suitable for converting: %s (Reason: %s)", wp.Name, e) log.Printf("Found waypoint not suitable for converting: %s (Reason: %s)", wp.Name, e)
} }
continue continue