*Objective:* To subtract 10 minutes from go's time.Time object(".StartsAt")
in html template (In specific the prometheus alertmanager's email template:
email_template.tmpl)
*Code: *<tr><td>error_timestamp</td><td>{{ .StartsAt }}</td></tr>
*Alertmanager version*: 0.20.0
*Options tried and corresponding errors :*
1. <td>{{ .StartsAt.Add(-10*time.Minute) }}</td> ::::::: Unexpected
operand "("
2. <td>{{ .StartsAt.Add "-10*time.Minute" }}</td> ::::::: expected
integer; found "-10*time.Minute\""
3. {{ $timestamp := .StartsAt.Add "10m" }} :::::::::::::::: wrong type for
value; expected time.Duration; got string
4. {{ $timestamp := Add .StartsAt "10m" }} ::::::::::: Add function not
defined
5. {{ $timestamp := .StartsAt.Add -10*time.Minute }} :::::::::::: time
function not defined
6. {{ $timestamp := .StartsAt.Add (-10*time.Minute) }} ::::::::::::
illegal operand *
7. {{ $timestamp := .StartsAt.Add (time.duration "10m") }} ::::::::::::
duration function not defined
8. {{ $timestamp := .StartsAt.Add (time.ParseDuration "10m") }}
:::::::::::: time function not defined
9. {{ $timestamp := .StartsAt.Add 10 }} ::::::::::: No error. But no
change in timestamp too.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/85742355-cd79-4f34-b6fd-97a52f0d2130o%40googlegroups.com.