removed unused return value

This commit is contained in:
Josh Baker 2016-12-16 14:02:58 -07:00
parent eab4973c20
commit 19da27b562
12 changed files with 54 additions and 54 deletions

View File

@ -15,32 +15,32 @@ type Feature struct {
idprops string // raw id and properties seperated by a '\0'
}
func fillFeatureMap(json string) (Feature, []byte, error) {
func fillFeatureMap(json string) (Feature, error) {
var g Feature
v := gjson.Get(json, "geometry")
switch v.Type {
default:
return g, nil, errInvalidGeometryMember
return g, errInvalidGeometryMember
case gjson.Null:
return g, nil, errGeometryMemberRequired
return g, errGeometryMemberRequired
case gjson.JSON:
var err error
g.Geometry, err = objectMap(v.Raw, feat)
if err != nil {
return g, nil, err
return g, err
}
}
var err error
g.BBox, err = fillBBox(json)
if err != nil {
return g, nil, err
return g, err
}
var propsExists bool
props := gjson.Get(json, "properties")
switch props.Type {
default:
return g, nil, errInvalidPropertiesMember
return g, errInvalidPropertiesMember
case gjson.Null:
case gjson.JSON:
propsExists = true
@ -49,7 +49,7 @@ func fillFeatureMap(json string) (Feature, []byte, error) {
if id.Exists() || propsExists {
g.idprops = makeCompositeRaw(id.Raw, props.Raw)
}
return g, nil, err
return g, err
}
// Geohash converts the object to a geohash value.

View File

@ -13,34 +13,34 @@ type FeatureCollection struct {
BBox *BBox
}
func fillFeatureCollectionMap(json string) (FeatureCollection, []byte, error) {
func fillFeatureCollectionMap(json string) (FeatureCollection, error) {
var g FeatureCollection
res := gjson.Get(json, "features")
switch res.Type {
default:
return g, nil, errInvalidFeaturesMember
return g, errInvalidFeaturesMember
case gjson.Null:
return g, nil, errFeaturesMemberRequired
return g, errFeaturesMemberRequired
case gjson.JSON:
if !resIsArray(res) {
return g, nil, errInvalidFeaturesMember
return g, errInvalidFeaturesMember
}
v := res.Array()
g.Features = make([]Object, len(v))
for i, res := range v {
if res.Type != gjson.JSON {
return g, nil, errInvalidFeature
return g, errInvalidFeature
}
o, err := objectMap(res.Raw, fcoll)
if err != nil {
return g, nil, err
return g, err
}
g.Features[i] = o
}
}
var err error
g.BBox, err = fillBBox(json)
return g, nil, err
return g, err
}
// Geohash converts the object to a geohash value.

View File

@ -13,34 +13,34 @@ type GeometryCollection struct {
BBox *BBox
}
func fillGeometryCollectionMap(json string) (GeometryCollection, []byte, error) {
func fillGeometryCollectionMap(json string) (GeometryCollection, error) {
var g GeometryCollection
res := gjson.Get(json, "geometries")
switch res.Type {
default:
return g, nil, errInvalidGeometries
return g, errInvalidGeometries
case gjson.Null:
return g, nil, errGeometriesRequired
return g, errGeometriesRequired
case gjson.JSON:
if !resIsArray(res) {
return g, nil, errInvalidGeometries
return g, errInvalidGeometries
}
v := res.Array()
g.Geometries = make([]Object, len(v))
for i, res := range v {
if res.Type != gjson.JSON {
return g, nil, errInvalidGeometry
return g, errInvalidGeometry
}
o, err := objectMap(res.Raw, gcoll)
if err != nil {
return g, nil, err
return g, err
}
g.Geometries[i] = o
}
}
var err error
g.BBox, err = fillBBox(json)
return g, nil, err
return g, err
}
// CalculatedBBox is exterior bbox containing the object.

View File

@ -9,12 +9,12 @@ import (
func resIsArray(res gjson.Result) bool {
if res.Type == gjson.JSON {
for i := 0; i < len(res.Raw); i++ {
if res.Raw[i] <= ' ' {
continue
}
if res.Raw[i] == '[' {
return true
}
if res.Raw[i] <= ' ' {
continue
}
break
}
}
@ -26,7 +26,7 @@ func resIsArray(res gjson.Result) bool {
////////////////////////////////
func fillLevel1Map(json string) (
coordinates Position, bbox *BBox, bytesOut []byte, err error,
coordinates Position, bbox *BBox, err error,
) {
coords := gjson.Get(json, "coordinates")
switch coords.Type {
@ -96,7 +96,7 @@ func level1IsCoordZDefined(coordinates Position, bbox *BBox) bool {
////////////////////////////////
func fillLevel2Map(json string) (
coordinates []Position, bbox *BBox, bytesOut []byte, err error,
coordinates []Position, bbox *BBox, err error,
) {
coords := gjson.Get(json, "coordinates")
switch coords.Type {
@ -186,7 +186,7 @@ func level2IsCoordZDefined(coordinates []Position, bbox *BBox) bool {
////////////////////////////////
func fillLevel3Map(json string) (
coordinates [][]Position, bbox *BBox, bytesOut []byte, err error,
coordinates [][]Position, bbox *BBox, err error,
) {
coords := gjson.Get(json, "coordinates")
switch coords.Type {
@ -305,7 +305,7 @@ func level3IsCoordZDefined(coordinates [][]Position, bbox *BBox) bool {
////////////////////////////////
func fillLevel4Map(json string) (
coordinates [][][]Position, bbox *BBox, bytesOut []byte, err error,
coordinates [][][]Position, bbox *BBox, err error,
) {
coords := gjson.Get(json, "coordinates")
switch coords.Type {

View File

@ -8,7 +8,7 @@ type LineString struct {
BBox *BBox
}
func fillLineString(coordinates []Position, bbox *BBox, b []byte, err error) (LineString, []byte, error) {
func fillLineString(coordinates []Position, bbox *BBox, err error) (LineString, error) {
if err == nil {
if len(coordinates) < 2 {
err = errLineStringInvalidCoordinates
@ -17,7 +17,7 @@ func fillLineString(coordinates []Position, bbox *BBox, b []byte, err error) (Li
return LineString{
Coordinates: coordinates,
BBox: bbox,
}, b, err
}, err
}
// CalculatedBBox is exterior bbox containing the object.

View File

@ -11,7 +11,7 @@ type MultiLineString struct {
BBox *BBox
}
func fillMultiLineString(coordinates [][]Position, bbox *BBox, b []byte, err error) (MultiLineString, []byte, error) {
func fillMultiLineString(coordinates [][]Position, bbox *BBox, err error) (MultiLineString, error) {
if err == nil {
for _, coordinates := range coordinates {
if len(coordinates) < 2 {
@ -23,7 +23,7 @@ func fillMultiLineString(coordinates [][]Position, bbox *BBox, b []byte, err err
return MultiLineString{
Coordinates: coordinates,
BBox: bbox,
}, b, err
}, err
}
// CalculatedBBox is exterior bbox containing the object.

View File

@ -11,11 +11,11 @@ type MultiPoint struct {
BBox *BBox
}
func fillMultiPoint(coordinates []Position, bbox *BBox, b []byte, err error) (MultiPoint, []byte, error) {
func fillMultiPoint(coordinates []Position, bbox *BBox, err error) (MultiPoint, error) {
return MultiPoint{
Coordinates: coordinates,
BBox: bbox,
}, b, err
}, err
}
// CalculatedBBox is exterior bbox containing the object.

View File

@ -8,7 +8,7 @@ type MultiPolygon struct {
BBox *BBox
}
func fillMultiPolygon(coordinates [][][]Position, bbox *BBox, b []byte, err error) (MultiPolygon, []byte, error) {
func fillMultiPolygon(coordinates [][][]Position, bbox *BBox, err error) (MultiPolygon, error) {
if err == nil {
outer:
for _, ps := range coordinates {
@ -27,7 +27,7 @@ func fillMultiPolygon(coordinates [][][]Position, bbox *BBox, b []byte, err erro
return MultiPolygon{
Coordinates: coordinates,
BBox: bbox,
}, b, err
}, err
}
// CalculatedBBox is exterior bbox containing the object.

View File

@ -195,23 +195,23 @@ func objectMap(json string, from int) (Object, error) {
default:
return nil, fmt.Errorf(fmtErrTypeIsUnknown, typ)
case "Point":
o, _, err = fillSimplePointOrPoint(fillLevel1Map(json))
o, err = fillSimplePointOrPoint(fillLevel1Map(json))
case "MultiPoint":
o, _, err = fillMultiPoint(fillLevel2Map(json))
o, err = fillMultiPoint(fillLevel2Map(json))
case "LineString":
o, _, err = fillLineString(fillLevel2Map(json))
o, err = fillLineString(fillLevel2Map(json))
case "MultiLineString":
o, _, err = fillMultiLineString(fillLevel3Map(json))
o, err = fillMultiLineString(fillLevel3Map(json))
case "Polygon":
o, _, err = fillPolygon(fillLevel3Map(json))
o, err = fillPolygon(fillLevel3Map(json))
case "MultiPolygon":
o, _, err = fillMultiPolygon(fillLevel4Map(json))
o, err = fillMultiPolygon(fillLevel4Map(json))
case "GeometryCollection":
o, _, err = fillGeometryCollectionMap(json)
o, err = fillGeometryCollectionMap(json)
case "Feature":
o, _, err = fillFeatureMap(json)
o, err = fillFeatureMap(json)
case "FeatureCollection":
o, _, err = fillFeatureCollectionMap(json)
o, err = fillFeatureCollectionMap(json)
}
return o, err
}

View File

@ -12,18 +12,18 @@ type Point struct {
BBox *BBox
}
func fillSimplePointOrPoint(coordinates Position, bbox *BBox, b []byte, err error) (Object, []byte, error) {
func fillSimplePointOrPoint(coordinates Position, bbox *BBox, err error) (Object, error) {
if coordinates.Z == 0 && bbox == nil {
return fillSimplePoint(coordinates, bbox, b, err)
return fillSimplePoint(coordinates, bbox, err)
}
return fillPoint(coordinates, bbox, b, err)
return fillPoint(coordinates, bbox, err)
}
func fillPoint(coordinates Position, bbox *BBox, b []byte, err error) (Point, []byte, error) {
func fillPoint(coordinates Position, bbox *BBox, err error) (Point, error) {
return Point{
Coordinates: coordinates,
BBox: bbox,
}, b, err
}, err
}
// CalculatedBBox is exterior bbox containing the object.

View File

@ -13,7 +13,7 @@ type Polygon struct {
BBox *BBox
}
func fillPolygon(coordinates [][]Position, bbox *BBox, b []byte, err error) (Polygon, []byte, error) {
func fillPolygon(coordinates [][]Position, bbox *BBox, err error) (Polygon, error) {
if err == nil {
if len(coordinates) == 0 {
err = errMustBeALinearRing
@ -30,7 +30,7 @@ func fillPolygon(coordinates [][]Position, bbox *BBox, b []byte, err error) (Pol
return Polygon{
Coordinates: coordinates,
BBox: bbox,
}, b, err
}, err
}
// CalculatedBBox is exterior bbox containing the object.

View File

@ -16,8 +16,8 @@ func New2DPoint(x, y float64) SimplePoint {
return SimplePoint{x, y}
}
func fillSimplePoint(coordinates Position, bbox *BBox, b []byte, err error) (SimplePoint, []byte, error) {
return SimplePoint{X: coordinates.X, Y: coordinates.Y}, b, err
func fillSimplePoint(coordinates Position, bbox *BBox, err error) (SimplePoint, error) {
return SimplePoint{X: coordinates.X, Y: coordinates.Y}, err
}
// CalculatedBBox is exterior bbox containing the object.