diff pkg/imports/wfsjob.go @ 5012:ae3a1392f9d0

Cosmetics: Tightened code a bit.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 11 Mar 2020 23:40:44 +0100
parents 2d7af72bb7ac
children 59a99655f34d
line wrap: on
line diff
--- a/pkg/imports/wfsjob.go	Wed Mar 11 19:29:07 2020 +0100
+++ b/pkg/imports/wfsjob.go	Wed Mar 11 23:40:44 2020 +0100
@@ -199,9 +199,6 @@
 				continue
 			}
 
-			// Optional wrapping
-			wrap := func(x interface{}) interface{} { return x }
-
 			// Look if we can deserialize given type
 			makeGeom := kindToGeometry[feature.Geometry.Type]
 			if makeGeom == nil {
@@ -209,6 +206,8 @@
 				continue
 			}
 
+			// Optional wrapping
+			wrap := func(x interface{}) interface{} { return x }
 			if feature.Geometry.Type != kind {
 				// Look if we can wrap it
 				if wrap = wrapGeomKind[[2]string{feature.Geometry.Type, kind}]; wrap == nil {
@@ -218,13 +217,11 @@
 			}
 
 			geom := makeGeom()
-
 			if err := json.Unmarshal(*feature.Geometry.Coordinates, geom); err != nil {
 				return err
 			}
 
-			err := consumer.Consume(wrap(geom), props, epsg)
-			switch {
+			switch err := consumer.Consume(wrap(geom), props, epsg); {
 			case err == ErrFeatureDuplicated:
 				dupes++
 			case err == ErrFeatureIgnored: