Simplifies https://golang.org/cl/33145
which fixed #17720.
Change-Id: Ib922d493cdc5920832dc95b55094796baca7243e
Reviewed-on: https://go-review.googlesource.com/33194
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
if January <= m && m <= December {
return months[m-1]
}
- const prefix = "%!Month("
- buf := make([]byte, 20+len(prefix)+1)
- buf[len(buf)-1] = ')'
- n := fmtInt(buf[:len(buf)-1], uint64(m))
- n -= len(prefix)
- copy(buf[n:], prefix)
- return string(buf[n:])
+ buf := make([]byte, 20)
+ n := fmtInt(buf, uint64(m))
+ return "%!Month(" + string(buf[n:]) + ")"
}
// A Weekday specifies a day of the week (Sunday = 0, ...).