olekukonko / tablewriter

ASCII table in golang
MIT License
4.29k stars 367 forks source link

incorrect placement of float64() #199

Open setharnold opened 2 years ago

setharnold commented 2 years ago

https://github.com/olekukonko/tablewriter/blob/74c60be0ef6886d331ebc3c91b2ac0a7971715b6/util.go#L68

Hello, Coverity flagged this line:

        gapLeft := int(math.Ceil(float64(gap / 2)))

as having a mistake -- the gap / 2 is truncated towards zero: https://go.dev/ref/spec#Integer_operators -- thus the math.Ceil() isn't doing anything.

Thanks