diff --git a/.golangci.yml b/.golangci.yml index 4ccc72966..d8bb620f4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -81,6 +81,7 @@ linters-settings: - badCall - badCond - badLock + - badRegexp - badSorting - builtinShadowDecl - caseOrder diff --git a/plugins/inputs/gnmi/path.go b/plugins/inputs/gnmi/path.go index e00af0dd6..e6ac208f8 100644 --- a/plugins/inputs/gnmi/path.go +++ b/plugins/inputs/gnmi/path.go @@ -8,7 +8,7 @@ import ( ) // Regular expression to see if a path element contains an origin -var originPattern = regexp.MustCompile(`^([\w-_]+):`) +var originPattern = regexp.MustCompile(`^([\w-]+):`) type keySegment struct { name string diff --git a/plugins/serializers/graphite/graphite.go b/plugins/serializers/graphite/graphite.go index 289a0cbcb..f41669707 100644 --- a/plugins/serializers/graphite/graphite.go +++ b/plugins/serializers/graphite/graphite.go @@ -17,8 +17,8 @@ import ( const DefaultTemplate = "host.tags.measurement.field" var ( - compatibleAllowedCharsName = regexp.MustCompile(`[^ "-:\<>-\]_a-~\p{L}]`) - compatibleAllowedCharsValue = regexp.MustCompile(`[^ -:<-~\p{L}]`) + compatibleAllowedCharsName = regexp.MustCompile(`[^ "-:\<>-\]_a-~\p{L}]`) //nolint: gocritic // valid range for use-case + compatibleAllowedCharsValue = regexp.MustCompile(`[^ -:<-~\p{L}]`) //nolint: gocritic // valid range for use-case compatibleLeadingTildeDrop = regexp.MustCompile(`^[~]*(.*)`) hyphenChars = strings.NewReplacer( "/", "-",