From cc2b2553cb7766d2f1ec1e6c4c094e3272040efa Mon Sep 17 00:00:00 2001 From: Albert Wang Date: Sat, 25 Feb 2023 12:05:35 -0800 Subject: [PATCH] Make LoadGeoJSON be private --- localtimezone.go | 9 ++++----- localtimezone_test.go | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/localtimezone.go b/localtimezone.go index 0a37c8f..e64bbb6 100644 --- a/localtimezone.go +++ b/localtimezone.go @@ -82,7 +82,6 @@ func init() { type LocalTimeZone interface { GetZone(p Point) (tzids []string, err error) GetOneZone(p Point) (tzid string, err error) - LoadGeoJSON(io.Reader) error } type tzData struct { @@ -125,7 +124,7 @@ func NewMockLocalTimeZone() LocalTimeZone { // The client is threadsafe func NewCustomLocalTimeZone(data io.Reader) (LocalTimeZone, error) { z := localTimeZone{} - err := z.LoadGeoJSON(data) + err := z.loadGeoJSON(data) return &z, err } @@ -135,7 +134,7 @@ func (z *localTimeZone) load(shapeFile []byte) error { return err } - err = z.LoadGeoJSON(g) + err = z.loadGeoJSON(g) _ = g.Close() if err != nil { return err @@ -275,8 +274,8 @@ func (z *localTimeZone) buildCache(features []*geojson.Feature) { sort.Strings(z.tzids) } -// LoadGeoJSON loads a custom GeoJSON shapefile from a Reader -func (z *localTimeZone) LoadGeoJSON(r io.Reader) error { +// loadGeoJSON loads a custom GeoJSON shapefile from a Reader +func (z *localTimeZone) loadGeoJSON(r io.Reader) error { z.mu.Lock() var buf bytes.Buffer diff --git a/localtimezone_test.go b/localtimezone_test.go index 0542f62..ae7b67d 100644 --- a/localtimezone_test.go +++ b/localtimezone_test.go @@ -414,7 +414,7 @@ func TestLoadGeoJSONMalformed(t *testing.T) { if !ok { t.Errorf("cannot initialize client") } - err = c.LoadGeoJSON(reader) + err = c.loadGeoJSON(reader) if err == nil { t.Errorf("expected error, got %v", err) }