Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Commit 225dcdf

Browse files
committed
Explicitly blank values on error returns
Addresses adrianmo#59 (comment)
1 parent 10c3894 commit 225dcdf

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

tagblock.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func parseTagBlock(raw string) (TagBlock, string, error) {
4747

4848
sumSepIndex := strings.Index(tags, ChecksumSep)
4949
if sumSepIndex == -1 {
50-
return tagBlock, "", fmt.Errorf("nmea: tagblock does not contain checksum separator")
50+
return TagBlock{}, "", fmt.Errorf("nmea: tagblock does not contain checksum separator")
5151
}
5252

5353
var (
@@ -59,7 +59,7 @@ func parseTagBlock(raw string) (TagBlock, string, error) {
5959

6060
// Validate the checksum
6161
if checksum != checksumRaw {
62-
return tagBlock, "", fmt.Errorf("nmea: tagblock checksum mismatch [%s != %s]", checksum, checksumRaw)
62+
return TagBlock{}, "", fmt.Errorf("nmea: tagblock checksum mismatch [%s != %s]", checksum, checksumRaw)
6363
}
6464

6565
items := strings.Split(tags[:sumSepIndex], ",")
@@ -73,7 +73,7 @@ func parseTagBlock(raw string) (TagBlock, string, error) {
7373
case "c": // UNIX timestamp
7474
tagBlock.Time, err = parseInt64(value)
7575
if err != nil {
76-
return tagBlock, raw, err
76+
return TagBlock{}, "", err
7777
}
7878
case "d": // Destination ID
7979
tagBlock.Destination = value
@@ -82,12 +82,12 @@ func parseTagBlock(raw string) (TagBlock, string, error) {
8282
case "n": // Line count
8383
tagBlock.LineCount, err = parseInt64(value)
8484
if err != nil {
85-
return tagBlock, raw, err
85+
return TagBlock{}, "", err
8686
}
8787
case "r": // Relative time
8888
tagBlock.RelativeTime, err = parseInt64(value)
8989
if err != nil {
90-
return tagBlock, raw, err
90+
return TagBlock{}, "", err
9191
}
9292
case "s": // Source ID
9393
tagBlock.Source = value

0 commit comments

Comments
 (0)