(value string)
| 186 | } |
| 187 | |
| 188 | func 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 | } |