From 7018ae4f9451efc285a6b3abe114a5e4bb31f550 Mon Sep 17 00:00:00 2001 From: mattverse Date: Thu, 7 Mar 2024 15:38:38 +0900 Subject: [PATCH] Make lint happy, make comment more clear --- types/coin.go | 7 ++----- types/coin_regex.go | 19 ++++++++++--------- types/coin_regex.rl | 3 ++- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/types/coin.go b/types/coin.go index b59533ffbbab..3f32bc349757 100644 --- a/types/coin.go +++ b/types/coin.go @@ -871,11 +871,8 @@ func ValidateDenom(denom string) error { if !MatchDenom(denomBytes) { return fmt.Errorf("invalid denom: %s", denom) } - } else { - // If reDnm has been initialized, use it for matching. - if !reDnm.MatchString(denom) { - return fmt.Errorf("invalid denom: %s", denom) - } + } else if !reDnm.MatchString(denom) { // If reDnm has been initialized, use it for matching. + return fmt.Errorf("invalid denom: %s", denom) } return nil diff --git a/types/coin_regex.go b/types/coin_regex.go index feaa2100cd56..dc21683bfd3c 100644 --- a/types/coin_regex.go +++ b/types/coin_regex.go @@ -1,6 +1,7 @@ //line coin_regex.rl:1 -// Code generated by regel using `ragel -Z coin_regex.rl`. +// `coin_regex.go` is generated by regel using `ragel -Z coin_regex.rl`. +// do not directly edit `coin_regex.go`. // source: types/coin_regex.rl // nolint:gocritic,unused,ineffassign @@ -17,9 +18,9 @@ package types func MatchDenom(data []byte) bool { -//line coin_regex.rl:18 +//line coin_regex.rl:19 -//line coin_regex.go:23 +//line coin_regex.go:24 var _scanner_actions []byte = []byte{ 0, 1, 0, } @@ -65,7 +66,7 @@ const scanner_error int = 0 const scanner_en_main int = 1 -//line coin_regex.rl:19 +//line coin_regex.rl:20 if len(data) < 3 || len(data) > 128 { return false @@ -73,12 +74,12 @@ const scanner_en_main int = 1 cs, p, pe, eof := 0, 0, len(data), len(data) _ = eof -//line coin_regex.go:77 +//line coin_regex.go:78 { cs = scanner_start } -//line coin_regex.go:82 +//line coin_regex.go:83 { var _klen int var _trans int @@ -158,9 +159,9 @@ _match: _acts++ switch _scanner_actions[_acts-1] { case 0: -//line coin_regex.rl:33 +//line coin_regex.rl:34 return true -//line coin_regex.go:164 +//line coin_regex.go:165 } } @@ -176,7 +177,7 @@ _again: _out: {} } -//line coin_regex.rl:37 +//line coin_regex.rl:38 return false } \ No newline at end of file diff --git a/types/coin_regex.rl b/types/coin_regex.rl index e0e371c59f19..4a4355162b89 100644 --- a/types/coin_regex.rl +++ b/types/coin_regex.rl @@ -1,4 +1,5 @@ -// Code generated by regel using `ragel -Z coin_regex.rl`. +// `coin_regex.go` is generated by regel using `ragel -Z coin_regex.rl`. +// do not directly edit `coin_regex.go`. // source: types/coin_regex.rl // nolint:gocritic,unused,ineffassign