Skip to content

Commit

Permalink
fix:use raw string () with regexp.MustCompile to avoid having to esca…
Browse files Browse the repository at this point in the history
…pe twice
  • Loading branch information
gongna-au committed Oct 5, 2023
1 parent 80f9681 commit e2f96fb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/metrics/stats/snake_case_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ var snakeConverters = []struct {
re *regexp.Regexp
repl string
}{
// example: LC -> L_C (e.g. CamelCase -> Camel_Case).
{regexp.MustCompile(`([a-z])([A-Z])`), "${1}_${2}"},
{regexp.MustCompile(`([A-Z])([A-Z][a-z])`), "${1}_${2}"},
{regexp.MustCompile(`\.`), "_"},
Expand Down

0 comments on commit e2f96fb

Please sign in to comment.