How it works...

The indentation is as simple as padding. In this case, the same formatting option is used. The more readable form of the indent implementation could use the Repeat function of the strings package. The IndentByRune function in the preceding code applies this approach.

Unindenting, in this case, means removing the given count of leading spaces. The implementation of Unindent in the preceding code removes the minimum number of leading spaces or given indentation.