changeset 4177:8b75ac5e243e

Made 'staticcheck' happy with pgxutils package.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 05 Aug 2019 17:16:46 +0200
parents c9315a6eb2c2
children 51e90370eced
files pkg/imports/agm.go pkg/imports/bn.go pkg/imports/config.go pkg/imports/dma.go pkg/imports/dmv.go pkg/imports/fd.go pkg/imports/sr.go pkg/imports/st.go pkg/imports/ubn.go pkg/imports/ufa.go pkg/imports/ugm.go pkg/imports/wa.go pkg/imports/wkb.go pkg/imports/wp.go pkg/imports/wx.go
diffstat 15 files changed, 38 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/agm.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/agm.go	Mon Aug 05 17:16:46 2019 +0200
@@ -220,7 +220,7 @@
 			if headerFields[j].name == h {
 				if *headerFields[j].idx != -1 {
 					return fmt.Errorf(
-						"There is more than one column namend '%s'", h)
+						"there is more than one column namend '%s'", h)
 				}
 				*headerFields[j].idx = i
 				continue nextHeader
@@ -235,7 +235,7 @@
 		}
 	}
 	if len(missing) > 0 {
-		return fmt.Errorf("Missing columns: %s", strings.Join(missing, ", "))
+		return fmt.Errorf("missing columns: %s", strings.Join(missing, ", "))
 	}
 
 	return nil
@@ -336,7 +336,7 @@
 		gids := row[fkGaugeIDIdx]
 		gid, err := models.IsrsFromString(gids)
 		if err != nil {
-			return nil, fmt.Errorf("Invalid ISRS code line %d: %v", line, err)
+			return nil, fmt.Errorf("invalid ISRS code line %d: %v", line, err)
 		}
 
 		if exists, found := checkedGauges[*gid]; found {
@@ -366,7 +366,7 @@
 
 		md, err := guessDate(row[measureDateIdx])
 		if err != nil {
-			return nil, fmt.Errorf("Invalid 'measure_date' line %d: %v", line, err)
+			return nil, fmt.Errorf("invalid 'measure_date' line %d: %v", line, err)
 		}
 		if v := mdMinMax[*gid]; v != nil {
 			if md.Before(v[0]) {
@@ -387,7 +387,7 @@
 
 		value, err := strconv.ParseFloat(row[valueIdx], 32)
 		if err != nil {
-			return nil, fmt.Errorf("Invalid 'value' line %d: %v", line, err)
+			return nil, fmt.Errorf("invalid 'value' line %d: %v", line, err)
 		}
 		newValue := value
 
@@ -517,7 +517,7 @@
 	}
 
 	if err = tx.Commit(); err != nil {
-		return nil, fmt.Errorf("Commit failed: %v", err)
+		return nil, fmt.Errorf("commit failed: %v", err)
 	}
 
 	// Sort here to mix the deletes right beside the matching inserts/updates.
--- a/pkg/imports/bn.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/bn.go	Mon Aug 05 17:16:46 2019 +0200
@@ -226,7 +226,7 @@
 
 		if resp.Export_bn_by_isrsResult == nil {
 			return nil, errors.New(
-				"The requested service returned no bottlenecks")
+				"the requested service returned no bottlenecks")
 		}
 
 		return resp.Export_bn_by_isrsResult.BottleNeckType, nil
--- a/pkg/imports/config.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/config.go	Mon Aug 05 17:16:46 2019 +0200
@@ -58,7 +58,7 @@
 	}
 
 	if !HasImportKindName(s) {
-		return fmt.Errorf("Unknown kind '%s'", s)
+		return fmt.Errorf("unknown kind '%s'", s)
 	}
 
 	*ik = ImportKind(s)
--- a/pkg/imports/dma.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/dma.go	Mon Aug 05 17:16:46 2019 +0200
@@ -124,7 +124,7 @@
 
 	ft := caps.FindFeatureType(dma.FeatureType)
 	if ft == nil {
-		return nil, fmt.Errorf("Unknown feature type '%s'", dma.FeatureType)
+		return nil, fmt.Errorf("unknown feature type '%s'", dma.FeatureType)
 	}
 
 	feedback.Info("Found feature type '%s'", dma.FeatureType)
@@ -247,7 +247,7 @@
 	}
 
 	if features == 0 {
-		err := errors.New("No features found")
+		err := errors.New("no features found")
 		feedback.Error("%v", err)
 		return nil, err
 	}
--- a/pkg/imports/dmv.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/dmv.go	Mon Aug 05 17:16:46 2019 +0200
@@ -169,7 +169,7 @@
 	feedback.Info("features: %d", features)
 
 	if features == 0 {
-		return nil, errors.New("No features found")
+		return nil, errors.New("no features found")
 	}
 
 	if err = tx.Commit(); err == nil {
--- a/pkg/imports/fd.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/fd.go	Mon Aug 05 17:16:46 2019 +0200
@@ -202,7 +202,7 @@
 
 	ft := caps.FindFeatureType(fd.FeatureType)
 	if ft == nil {
-		return nil, fmt.Errorf("Unknown feature type '%s'", fd.FeatureType)
+		return nil, fmt.Errorf("unknown feature type '%s'", fd.FeatureType)
 	}
 
 	feedback.Info("Found feature type '%s'", fd.FeatureType)
--- a/pkg/imports/sr.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/sr.go	Mon Aug 05 17:16:46 2019 +0200
@@ -237,7 +237,7 @@
 
 	mf := common.FindInZIP(z, "meta.json")
 	if mf == nil && !sr.completeOverride() {
-		return nil, errors.New("Cannot find 'meta.json'")
+		return nil, errors.New("cannot find 'meta.json'")
 	}
 
 	m, err := sr.loadMeta(mf)
@@ -270,7 +270,7 @@
 		)
 		switch {
 		case err == sql.ErrNoRows:
-			return nil, errors.New("Cannot load LDC value")
+			return nil, errors.New("cannot load LDC value")
 		case err != nil:
 			return nil, err
 		}
@@ -300,7 +300,7 @@
 			}
 		}
 		if xyzf == nil {
-			return nil, errors.New("Cannot find any *.xyz or *.txt file")
+			return nil, errors.New("cannot find any *.xyz or *.txt file")
 		}
 		xyz, err = loadXYZ(xyzf, feedback, xform)
 	} else { // TXT file mode
@@ -608,7 +608,7 @@
 	switch {
 	case err == sql.ErrNoRows:
 		return nil, fmt.Errorf(
-			"No matching bottleneck of given name or time available: %v", err)
+			"no matching bottleneck of given name or time available: %v", err)
 	case err != nil:
 		return nil, err
 	}
@@ -801,7 +801,7 @@
 	prefix := strings.TrimSuffix(shpF.Name, path.Ext(shpF.Name))
 	dbfF := common.FindInZIP(z, prefix+".dbf")
 	if dbfF == nil {
-		return nil, fmt.Errorf("No DBF file found for %s", shpF.Name)
+		return nil, fmt.Errorf("no DBF file found for %s", shpF.Name)
 	}
 
 	shpR, err := shpF.Open()
--- a/pkg/imports/st.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/st.go	Mon Aug 05 17:16:46 2019 +0200
@@ -159,7 +159,7 @@
 	feedback.Info("Storing stretch '%s'", st.Name)
 
 	if len(st.Countries) == 0 {
-		return nil, errors.New("List of countries is empty")
+		return nil, errors.New("list of countries is empty")
 	}
 
 	tx, err := conn.BeginTx(ctx, nil)
--- a/pkg/imports/ubn.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/ubn.go	Mon Aug 05 17:16:46 2019 +0200
@@ -80,7 +80,7 @@
 		}
 
 		if dst.Export_bn_by_isrsResult == nil {
-			return nil, errors.New("No bottlenecks found")
+			return nil, errors.New("no bottlenecks found")
 		}
 
 		return dst.Export_bn_by_isrsResult.BottleNeckType, nil
--- a/pkg/imports/ufa.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/ufa.go	Mon Aug 05 17:16:46 2019 +0200
@@ -83,7 +83,7 @@
 
 		result := response.Get_bottleneck_faResult
 		if result == nil {
-			return nil, errors.New("No bottlenecks found")
+			return nil, errors.New("no bottlenecks found")
 		}
 
 		return result.FairwayAvailability, nil
--- a/pkg/imports/ugm.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/ugm.go	Mon Aug 05 17:16:46 2019 +0200
@@ -67,7 +67,7 @@
 		}
 
 		if len(dst.Result_message) == 0 {
-			return nil, errors.New("No gauge measurements found")
+			return nil, errors.New("no gauge measurements found")
 		}
 		return dst.Result_message, nil
 	}
--- a/pkg/imports/wa.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/wa.go	Mon Aug 05 17:16:46 2019 +0200
@@ -130,7 +130,7 @@
 
 	ft := caps.FindFeatureType(wx.FeatureType)
 	if ft == nil {
-		return nil, fmt.Errorf("Unknown feature type '%s'", wx.FeatureType)
+		return nil, fmt.Errorf("unknown feature type '%s'", wx.FeatureType)
 	}
 
 	feedback.Info("Found feature type '%s", wx.FeatureType)
@@ -277,7 +277,7 @@
 	}
 
 	if features == 0 {
-		err := errors.New("No features found")
+		err := errors.New("no features found")
 		feedback.Error("%v", err)
 		return nil, err
 	}
--- a/pkg/imports/wkb.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/wkb.go	Mon Aug 05 17:16:46 2019 +0200
@@ -120,7 +120,7 @@
 	case *shp.PolygonM:
 		return toPolygon(p.NumParts, p.Parts, p.Points), nil
 	}
-	return nil, fmt.Errorf("Unsupported shape type %T", s)
+	return nil, fmt.Errorf("unsupported shape type %T", s)
 }
 
 func toPolygon(numParts int32, parts []int32, points []shp.Point) polygonSlice {
--- a/pkg/imports/wp.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/wp.go	Mon Aug 05 17:16:46 2019 +0200
@@ -180,7 +180,7 @@
 
 	if err := tx.Commit(); err != nil {
 		return nil, fmt.Errorf(
-			"Importing waterway profiles failed after %s: %v",
+			"importing waterway profiles failed after %s: %v",
 			time.Since(start), err)
 	}
 
@@ -207,7 +207,7 @@
 
 	ft := caps.FindFeatureType(wp.FeatureType)
 	if ft == nil {
-		return fmt.Errorf("Unknown feature type '%s'", wp.FeatureType)
+		return fmt.Errorf("unknown feature type '%s'", wp.FeatureType)
 	}
 
 	feedback.Info("Found feature type '%s", wp.FeatureType)
@@ -305,7 +305,7 @@
 	}
 
 	if features == 0 {
-		return errors.New("No features found")
+		return errors.New("no features found")
 	}
 	if _, err := tx.ExecContext(ctx, analyzeTempTableSQL); err != nil {
 		return err
@@ -454,7 +454,7 @@
 		location, err := models.IsrsFromString(row[locationIdx])
 		if err != nil {
 			return nil, fmt.Errorf(
-				"Invalid ISRS location code in line %d: %v",
+				"invalid ISRS location code in line %d: %v",
 				line, err)
 		}
 
@@ -481,13 +481,13 @@
 		validFromTime, err := parseDate(row[validFromIdx])
 		if err != nil {
 			return nil, fmt.Errorf(
-				"Invalid 'valid_from' value in line %d: %v",
+				"invalid 'valid_from' value in line %d: %v",
 				line, err)
 		}
 		validToTime, err := parseDate(row[validToIdx])
 		if err != nil {
 			return nil, fmt.Errorf(
-				"Invalid 'valid_to' value in line %d: %v",
+				"invalid 'valid_to' value in line %d: %v",
 				line, err)
 		}
 
@@ -512,31 +512,31 @@
 		lnwl, err := parseFloat64(row[lnwlIdx])
 		if err != nil {
 			return nil, fmt.Errorf(
-				"Invalid 'lnwl' value in line %d: %v",
+				"invalid 'lnwl' value in line %d: %v",
 				line, err)
 		}
 		mwl, err := parseFloat64(row[mwlIdx])
 		if err != nil {
 			return nil, fmt.Errorf(
-				"Invalid 'mwl' value in line %d: %v",
+				"invalid 'mwl' value in line %d: %v",
 				line, err)
 		}
 		hnwl, err := parseFloat64(row[hnwlIdx])
 		if err != nil {
 			return nil, fmt.Errorf(
-				"Invalid 'hnwl' value in line %d: %v",
+				"invalid 'hnwl' value in line %d: %v",
 				line, err)
 		}
 		fe30, err := parseFloat64(row[fe30Idx])
 		if err != nil {
 			return nil, fmt.Errorf(
-				"Invalid 'fe30' value in line %d: %v",
+				"invalid 'fe30' value in line %d: %v",
 				line, err)
 		}
 		fe100, err := parseFloat64(row[fe100Idx])
 		if err != nil {
 			return nil, fmt.Errorf(
-				"Invalid 'fe100' value in line %d: %v",
+				"invalid 'fe100' value in line %d: %v",
 				line, err)
 		}
 
@@ -546,7 +546,7 @@
 			dateInfo = start
 		} else if dateInfo, err = parseDate(di); err != nil {
 			return nil, fmt.Errorf(
-				"Invalid 'date_info' value in line %d: %v",
+				"invalid 'date_info' value in line %d: %v",
 				line, err)
 		}
 
--- a/pkg/imports/wx.go	Mon Aug 05 16:58:53 2019 +0200
+++ b/pkg/imports/wx.go	Mon Aug 05 17:16:46 2019 +0200
@@ -130,7 +130,7 @@
 
 	ft := caps.FindFeatureType(wx.FeatureType)
 	if ft == nil {
-		return nil, fmt.Errorf("Unknown feature type '%s'", wx.FeatureType)
+		return nil, fmt.Errorf("unknown feature type '%s'", wx.FeatureType)
 	}
 
 	feedback.Info("Found feature type '%s", wx.FeatureType)
@@ -282,7 +282,7 @@
 	}
 
 	if features == 0 {
-		return nil, errors.New("No features found")
+		return nil, errors.New("no features found")
 	}
 
 	if err = tx.Commit(); err == nil {