MCPcopy Create free account
hub / github.com/cortexproject/cortex / cleanupDuration

Function cleanupDuration

tools/doc-generator/writer.go:188–202  ·  view source on GitHub ↗
(value string)

Source from the content-addressed store, hash-verified

186}
187
188func cleanupDuration(value string) string {
189 // This is the list of suffixes to remove from the duration if they're not
190 // the whole duration value.
191 suffixes := []string{"0s", "0m"}
192
193 for _, suffix := range suffixes {
194 re := regexp.MustCompile("(^.+\\D)" + suffix + "$")
195
196 if groups := re.FindStringSubmatch(value); len(groups) == 2 {
197 value = groups[1]
198 }
199 }
200
201 return value
202}

Callers 1

writeConfigEntryMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected