3 ms·
> If base == 0, the base is implied by the string’s prefix: base 16 for "0x", base 8 for "0", and base 10 otherwise. For bases 1, below 0 or above 36 an error i
by karmakaze 9y ago
> If base == 0, the base is implied by the string’s prefix: base 16 for "0x", base 8 for "0", and base 10 otherwise. For bases 1, below 0 or above 36 an error is returned.
A better solution is to always provide the base (e.g. 10) rather than using 0 if you don't want special interpretation of '0x' and '0' prefixes. That should be in Hugo. The problem is not with the golang library which was well documented and always worked as such. By placing any blame on the golang library, there's less incentive to fix Hugo.
- kaushalmodi 9y agoThat's a valid point. I have made that suggestion to the Hugo devs[1]. Someone on Reddit also suggested using strconv.Atoi() instead of ParseInt(). I have added to the suggestion too. [1]: https://github.com/gohugoio/hugo/issues/4628#issuecomment-382595019 https://github.com/gohugoio/hugo/issues/4628#issuecomment-38...