From 99cdff61a3c10baa923ab511d8efa35678e3c3bd Mon Sep 17 00:00:00 2001 From: chenquan Date: Sun, 6 Feb 2022 17:48:25 +0800 Subject: [PATCH 1/2] chore: fix reviewdog issues --- xstring/xstring.go | 3 ++- xstring/xstring_test.go | 2 +- xtask/do_test.go | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/xstring/xstring.go b/xstring/xstring.go index 1376534..85d6508 100644 --- a/xstring/xstring.go +++ b/xstring/xstring.go @@ -493,7 +493,8 @@ func Contains(s string, searchChar string) bool { // IsNumerical returns ture if a numerical. func IsNumerical(s string) bool { - reg, _ := regexp.Compile("^\\d+.?\\d*$") + expr := `^\d+.?\d*$` + reg, _ := regexp.Compile(expr) return reg.MatchString(s) } diff --git a/xstring/xstring_test.go b/xstring/xstring_test.go index 7c4462b..81e3f83 100644 --- a/xstring/xstring_test.go +++ b/xstring/xstring_test.go @@ -765,7 +765,7 @@ func genStrs() []string { strset := make([]string, 0, 50) builder := strings.Builder{} for i := 0; i < 50; i++ { - for j := 0; i < i; j++ { + for j := 0; j < i; j++ { if i%2 == 0 { builder.WriteString(alphabet) } else { diff --git a/xtask/do_test.go b/xtask/do_test.go index b051fe6..d68c81b 100644 --- a/xtask/do_test.go +++ b/xtask/do_test.go @@ -29,8 +29,6 @@ func TestDoWithPanic(t *testing.T) { assert.Panics(t, func() { _ = DoWithTimeout(time.Second, func() (err error) { panic("") - - return nil }, func() { }) From 432c1e7155a00cc7d4a683c2eedd54d0cad0b64b Mon Sep 17 00:00:00 2001 From: chenquan Date: Sun, 6 Feb 2022 17:49:10 +0800 Subject: [PATCH 2/2] chore: fix reviewdog issues --- xstring/xstring.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xstring/xstring.go b/xstring/xstring.go index 85d6508..8ead1e3 100644 --- a/xstring/xstring.go +++ b/xstring/xstring.go @@ -493,8 +493,7 @@ func Contains(s string, searchChar string) bool { // IsNumerical returns ture if a numerical. func IsNumerical(s string) bool { - expr := `^\d+.?\d*$` - reg, _ := regexp.Compile(expr) + reg, _ := regexp.Compile(`^\d+.?\d*$`) return reg.MatchString(s) }