Line
d := float64(length / pagesize)
Converts to swim result of division. Since the partition itself is a whole division, it leads to 4, so d = 4.0 and math.Ceil(d) is 4.
Replace the string with
d := float64(length) / float64(pagesize)
and you will have d=4.3 and int(math.Ceil(d))=5 .
source share