summaryrefslogtreecommitdiff
path: root/random/random.go
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2022-02-01 12:36:24 -0500
committerDave Henderson <dhenderson@gmail.com>2022-02-01 12:36:24 -0500
commitd76cb3b452891fc1bdda75e1db2be6753ffcc427 (patch)
tree2c0e40104ff329055d3f6a72e178e338f5c56871 /random/random.go
parenta2265a15117611e1fcc6a7ed3cf5f3d625f2f4a7 (diff)
Fix lint failures around error strings
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'random/random.go')
-rw-r--r--random/random.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/random/random.go b/random/random.go
index e7b9d6df..eb993f57 100644
--- a/random/random.go
+++ b/random/random.go
@@ -2,13 +2,12 @@
package random
import (
+ "fmt"
"math"
"math/rand"
"regexp"
"time"
"unicode"
-
- "github.com/pkg/errors"
)
func init() {
@@ -39,7 +38,7 @@ func StringRE(count int, match string) (r string, err error) {
func StringBounds(count int, lower, upper rune) (r string, err error) {
chars := filterRange(lower, upper)
if len(chars) == 0 {
- return "", errors.Errorf("No printable codepoints found between U%#q and U%#q.", lower, upper)
+ return "", fmt.Errorf("no printable codepoints found between U%#q and U%#q", lower, upper)
}
return rndString(count, chars)
}
@@ -82,7 +81,7 @@ func matchChars(match string) ([]rune, error) {
// Item -
func Item(items []interface{}) (interface{}, error) {
if len(items) == 0 {
- return nil, errors.Errorf("expected a non-empty array or slice")
+ return nil, fmt.Errorf("expected a non-empty array or slice")
}
if len(items) == 1 {
return items[0], nil
@@ -96,13 +95,13 @@ func Item(items []interface{}) (interface{}, error) {
// Number -
func Number(min, max int64) (int64, error) {
if min > max {
- return 0, errors.Errorf("min must not be greater than max (was %d, %d)", min, max)
+ return 0, fmt.Errorf("min must not be greater than max (was %d, %d)", min, max)
}
if min == math.MinInt64 {
min++
}
if max-min >= (math.MaxInt64 >> 1) {
- return 0, errors.Errorf("spread between min and max too high - must not be greater than 63-bit maximum (%d - %d = %d)", max, min, max-min)
+ return 0, fmt.Errorf("spread between min and max too high - must not be greater than 63-bit maximum (%d - %d = %d)", max, min, max-min)
}
//nolint:gosec