changeset 4847:4847ac70103a

Made staticcheck happy. - error strings should not end with punctuation or a newline (ST1005) - error strings should not be capitalized (ST1005)
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 18 Nov 2019 11:54:20 +0100
parents c69e35ec6adf
children 8584197232ec
files pkg/controllers/diff.go pkg/controllers/stretches.go pkg/imports/dsec.go pkg/imports/dsr.go pkg/mesh/classbreaks.go pkg/mesh/tin.go pkg/models/common.go pkg/models/cross.go pkg/models/importbase.go pkg/models/user.go
diffstat 10 files changed, 24 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/diff.go	Thu Nov 14 14:53:15 2019 +0100
+++ b/pkg/controllers/diff.go	Mon Nov 18 11:54:20 2019 +0100
@@ -172,7 +172,7 @@
 	}
 
 	if minuendTree == nil {
-		return 0, fmt.Errorf("Cannot find survey for %s/%s.",
+		return 0, fmt.Errorf("cannot find survey for %s/%s",
 			dci.Bottleneck,
 			dci.Minuend.Format(common.DateFormat))
 	}
@@ -190,13 +190,13 @@
 		dci.Subtrahend.Time,
 	).Scan(&box.X1, &box.Y1, &box.X2, &box.Y2); {
 	case err == sql.ErrNoRows:
-		return 0, errors.New("No such intersection")
+		return 0, errors.New("no such intersection")
 	case err != nil:
 		return 0, err
 	}
 
 	if box.Empty() {
-		return 0, errors.New("Intersection is empty")
+		return 0, errors.New("intersection is empty")
 	}
 
 	log.Printf("info: bbox of intersection: (%.2f, %.2f) - (%.2f, %.2f)\n",
@@ -221,15 +221,15 @@
 	}
 
 	if subtrahendTree == nil {
-		return 0, fmt.Errorf("Cannot find survey for %s/%s.",
+		return 0, fmt.Errorf("cannot find survey for %s/%s",
 			dci.Bottleneck,
 			dci.Subtrahend.Format(common.DateFormat))
 	}
 
 	// We need a slow path implementation for this.
 	if epsg != subtrahendTree.EPSG() {
-		return 0, errors.New("Calculating differences between two different " +
-			"EPSG code meshes are not supported, yet.")
+		return 0, errors.New("calculating differences between two different " +
+			"EPSG code meshes are not supported, yet")
 	}
 
 	start = time.Now()
@@ -246,7 +246,7 @@
 
 	zMin, zMax, ok := raster.ZExtent()
 	if !ok {
-		return 0, errors.New("Scans do not have common points")
+		return 0, errors.New("scans do not have common points")
 	}
 
 	log.Printf("info: z range: %.3f - %.3f\n", zMin, zMax)
--- a/pkg/controllers/stretches.go	Thu Nov 14 14:53:15 2019 +0100
+++ b/pkg/controllers/stretches.go	Mon Nov 18 11:54:20 2019 +0100
@@ -135,7 +135,7 @@
 	}
 
 	if len(ldc) == 0 {
-		return nil, fmt.Errorf("No LDC found for bottleneck: %s", bn.name)
+		return nil, fmt.Errorf("no LDC found for bottleneck: %s", bn.name)
 	}
 
 	var access func(*availMeasurement) float64
--- a/pkg/imports/dsec.go	Thu Nov 14 14:53:15 2019 +0100
+++ b/pkg/imports/dsec.go	Mon Nov 18 11:54:20 2019 +0100
@@ -79,7 +79,7 @@
 	}
 	if n == 0 {
 		return errors.New(
-			"Nothing deleted. Probably due to missing access rights.")
+			"nothing deleted. Probably due to missing access rights")
 	}
 	return err
 }
--- a/pkg/imports/dsr.go	Thu Nov 14 14:53:15 2019 +0100
+++ b/pkg/imports/dsr.go	Mon Nov 18 11:54:20 2019 +0100
@@ -81,9 +81,9 @@
 		return err
 	}
 	if rows == 0 {
-		return errors.New("Deletion failed.  " +
+		return errors.New("deletion failed. " +
 			"Propably Data outside the area of responsibility." +
-			"Or the data was already deleted by another user.")
+			"Or the data was already deleted by another user")
 	}
 	return err
 }
--- a/pkg/mesh/classbreaks.go	Thu Nov 14 14:53:15 2019 +0100
+++ b/pkg/mesh/classbreaks.go	Mon Nov 18 11:54:20 2019 +0100
@@ -92,7 +92,7 @@
 	case err != nil:
 		return nil, err
 	case !config.Valid:
-		return nil, errors.New("Invalid config string")
+		return nil, errors.New("invalid config string")
 	}
 
 	return ParseClassBreaks(config.String)
--- a/pkg/mesh/tin.go	Thu Nov 14 14:53:15 2019 +0100
+++ b/pkg/mesh/tin.go	Mon Nov 18 11:54:20 2019 +0100
@@ -27,8 +27,8 @@
 )
 
 var (
-	errNoByteSlice   = errors.New("Not a byte slice")
-	errTooLessPoints = errors.New("Too less points")
+	errNoByteSlice   = errors.New("not a byte slice")
+	errTooLessPoints = errors.New("too less points")
 )
 
 // Tin stores a mesh of triangles with common vertices.
--- a/pkg/models/common.go	Thu Nov 14 14:53:15 2019 +0100
+++ b/pkg/models/common.go	Mon Nov 18 11:54:20 2019 +0100
@@ -25,8 +25,8 @@
 )
 
 var (
-	errNoString    = errors.New("Not a string")
-	errNoByteSlice = errors.New("Not a byte slice")
+	errNoString    = errors.New("not a string")
+	errNoByteSlice = errors.New("not a byte slice")
 )
 
 // WGS84 is the EPSG of the World Geodetic System 1984.
--- a/pkg/models/cross.go	Thu Nov 14 14:53:15 2019 +0100
+++ b/pkg/models/cross.go	Mon Nov 18 11:54:20 2019 +0100
@@ -81,10 +81,10 @@
 )
 
 var (
-	errNoGeoJSONFeature        = errors.New("Not a valid GeoJSON feature")
-	errNoGeoJSONLineStringType = errors.New("Not a valid GeoJSON linestring type")
-	errTooLessComponents       = errors.New("Too less components in coordinate")
-	errTooLessCoordinates      = errors.New("Too less coordinates")
+	errNoGeoJSONFeature        = errors.New("not a valid GeoJSON feature")
+	errNoGeoJSONLineStringType = errors.New("not a valid GeoJSON linestring type")
+	errTooLessComponents       = errors.New("too less components in coordinate")
+	errTooLessCoordinates      = errors.New("too less coordinates")
 )
 
 func (lc *GeoJSONLineCoordinates) UnmarshalJSON(data []byte) error {
--- a/pkg/models/importbase.go	Thu Nov 14 14:53:15 2019 +0100
+++ b/pkg/models/importbase.go	Mon Nov 18 11:54:20 2019 +0100
@@ -84,7 +84,7 @@
 		return err
 	}
 	if dur < 0 {
-		return errors.New("duration has to be none negative.")
+		return errors.New("duration has to be none negative")
 	}
 	*cd = ConfigDuration{dur}
 	return nil
--- a/pkg/models/user.go	Thu Nov 14 14:53:15 2019 +0100
+++ b/pkg/models/user.go	Mon Nov 18 11:54:20 2019 +0100
@@ -68,7 +68,7 @@
 			`:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]` +
 			`|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])`)
 
-	errNoEmailAddress = errors.New("Not a valid email address")
+	errNoEmailAddress = errors.New("not a valid email address")
 )
 
 // UnmarshalJSON ensures that the given string forms a valid email address.
@@ -99,7 +99,7 @@
 	return
 }
 
-var errNoValidUser = errors.New("Not a valid user")
+var errNoValidUser = errors.New("not a valid user")
 
 // IsValid checks if a given user name is valid.
 func (u UserName) IsValid() bool {
@@ -135,7 +135,7 @@
 		"waterway_admin",
 		"sys_admin",
 	}
-	errNoValidRole = errors.New("Not a valid role")
+	errNoValidRole = errors.New("not a valid role")
 )
 
 // Value implements the driver.Valuer interface.