Skip to content

Commit d810d6a

Browse files
extend ZipCodeLocation struct with StateCode type
1 parent 8da45b6 commit d810d6a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

zipcodes.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type ZipCodeLocation struct {
2424
AdminName string
2525
Lat float64
2626
Lon float64
27+
StateCode string
2728
}
2829

2930
// Zipcodes contains the whole list of structs representing
@@ -190,6 +191,7 @@ func LoadDataset(datasetPath string) (Zipcodes, error) {
190191
AdminName: splittedLine[3],
191192
Lat: lat,
192193
Lon: lon,
194+
StateCode: splittedLine[4],
193195
}
194196
}
195197

zipcodes_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ func TestLookup(t *testing.T) {
7070
AdminName: "Brandenburg",
7171
Lat: 51.4167,
7272
Lon: 13.9333,
73+
StateCode: "BB",
7374
}
7475

7576
if reflect.DeepEqual(foundedZC, &expectedZipCode) != true {

0 commit comments

Comments
 (0)