Skip to content

Commit

Permalink
better explanation of the reasoning behind inconsistent pointer/no po…
Browse files Browse the repository at this point in the history
…inter receiver in the Country struct methods. Also some memory improvements in subdivision struct
  • Loading branch information
pariz committed Jul 30, 2017
1 parent b4ebec2 commit a6cd508
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions country.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ type Country struct {
}

// MeasurableCoordinates provides long/lat for country struct
// it does not store a pointer receiver to Country, as it needs to implement the
// Measurer interface
func (c Country) MeasurableCoordinates() (lat, long float64) {

return c.Coordinates.Latitude, c.Coordinates.Longitude
Expand Down
2 changes: 1 addition & 1 deletion subdivision.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type SubDivision struct {
}

// MeasurableCoordinates provides long/lat for country struct
func (sd SubDivision) MeasurableCoordinates() (lat, long float64) {
func (sd *SubDivision) MeasurableCoordinates() (lat, long float64) {

return sd.Coordinates.Latitude, sd.Coordinates.Longitude

Expand Down

0 comments on commit a6cd508

Please sign in to comment.