mirror of
https://github.com/Luzifer/gpxhydrant.git
synced 2024-11-12 17:12:43 +00:00
Fix: Followed linter advice
This commit is contained in:
parent
8a1341a462
commit
720ba1191d
1 changed files with 3 additions and 3 deletions
6
main.go
6
main.go
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue