Chapter 18
Ten Useful Go Packages to Create Applications
IN THIS CHAPTER
Exploring third-party Go packages
Becoming a better Go developer
Go comes with various standard libraries that enable you to accomplish most of the tasks you need to perform. However, sometimes you need more than what the standard library offers. Fortunately, thanks to the vibrant Go developer community, chances are, the functionalities you need are already fulfilled by one or more of the third-party packages available. So, instead of reinventing the wheel and writing the code yourself, you can simply download the package and use it in your program. In this chapter, I introduce ten packages that you may find useful in your application.
color
Tired of the boring black-and-white command-line applications? Inject some life into your Go command-line app using the color
package. With the color
package, you can use different colors in your app to highlight important messages or errors.
Installation
$ go get github.com/fatih/color
Code sample
package main import "github.com/fatih/color" func main() { color.Red("Error Message") color.Green("Retro…") color.Blue("Color is cool!") customBg := color.New(color.FgBlue).Add( color.BgWhite).Add(color.Italic) customBg.Println("How does this look like?")}
now
Anyone ...
Get Go Programming Language For Dummies now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.