jonas-p / go-shp

Go library for reading and writing ESRI Shapefiles. Pure Golang implementation based on the ESRI Shapefile technical description.
MIT License
258 stars 68 forks source link

Remove log.Fatal call from reader #20

Closed tdilo closed 7 years ago

tdilo commented 7 years ago

When an unsupported shape type is encountered, log.Fatal is called. This is undesirable for a library, as the user should decide when to abort program execution.

This change modifies newShape to return an error when encountering an unsupported shape type, and adds a test to verify that reading is aborted in this case. To facilitate testing, the hard dependency on os.File in the Reader is replaced with an interface encapsulating all required methods.