Go · Golang

Create a Boolean Yes or No prompt in Go


In this post, I will create a simple function that will allow you to ask the user a question, receive a valid response, and return it as a Boolean type. And if needed, the user will be able to tap Ctrl+C at any time to exit the program. Also importantly, despite using the operating system… Continue reading Create a Boolean Yes or No prompt in Go

Go · Golang

Go byte units and localized formatting


This article will go through creating byte unit methods for both metric and binary prefixes. The two stringers will take a float64 value and round it with a metric unit. Decimal(15000).String() would return 15.0 kBBinary(15000).String() would return 14.6 KiB Unlike many other byte converters, this will also format the number using international digit separators. While… Continue reading Go byte units and localized formatting