diff pkg/imports/agm.go @ 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 5a650cde0574
children 51e90370eced
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.