- From your Terminal or console application,createa new directory called~/projects/go-programming-cookbook/chapter2/ansicolor.
- Navigate to this directory.
- Run the following command:
Coloring an ANSI terminal application is handled by a variety of code before and after a section of text you want colored. This recipe will explore a basic coloring mechanism that colors text red or plain. For a complete application, take a look at https://github.com/agtorre/gocolorize, which supports many more colors and text types, and also implements the fmt.Formatter interface for ease of printing.
How to do it...
These steps cover writing and running your application:
$ go mod init github.com/PacktPublishing/Go-Programming-Cookbook-Second-Edition/chapter2/ansicolor
You should see a file calledgo.modthat contains the following:
module github...