summaryrefslogtreecommitdiff
path: root/re.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-10-25 19:25:10 +0200
committerDimitri Sokolyuk <demon@dim13.org>2018-10-25 19:25:10 +0200
commitdd45f63209a8e51979b11182253ee80b5289c10a (patch)
treee57bbe08c4c56f53c25f98defc06d4b6410453a4 /re.go
parent26792c0f50572f15b4851d439387afb7c8cdc046 (diff)
Drop Version, make lint happy
Diffstat (limited to 're.go')
-rw-r--r--re.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/re.go b/re.go
index 4d3fa48..fab6386 100644
--- a/re.go
+++ b/re.go
@@ -6,17 +6,17 @@ import (
"strings"
)
-var ErrNotRE = errors.New("not re")
+var errNotRE = errors.New("not re")
func re(s, r string, global bool) (string, error) {
// min: at least two separators
if len(r) < 2 {
- return "", ErrNotRE
+ return "", errNotRE
}
z := strings.Split(r[1:], string(r[0]))
// match // and ///
if len(z) < 2 || len(z) > 3 {
- return "", ErrNotRE
+ return "", errNotRE
}
re, err := regexp.Compile(z[0])
if err != nil {
@@ -28,7 +28,7 @@ func re(s, r string, global bool) (string, error) {
}
return re.ReplaceAllStringFunc(s, func(b string) string {
if i != 0 {
- i -= 1
+ i--
return z[1]
}
return b