Wrapping Up

Let's wrap up this chapter.

We'll cover the following

Summary

When it comes to distributing our application, Go supports many alternatives. Because Go applications don’t require an interpreter or a runtime, we can distribute our application in binary form, and users can run it without installing or maintaining extra dependencies. We can also distribute it as source code so users can build it themselves according to their requirements.

In this chapter:

  • We created a new package that enables our applications to send system notifications and supports different operating systems.

  • We designed this package to use different implementations according to the target operating system by using Go build constraints.

  • We included the notification package in the Pomodoro application and used build tags to conditionally build it for different requirements.

  • We explored several options for building and distributing our application in binary form and as source code.

  • We used the power and flexibility of cross-compilation to build binaries for different platforms using a single-source system.

  • We also created container images so users can run our application as Linux containers.

The Go toolchain provides a complete set of tools that allows us to develop automated ways to build our application in a consistent and repeatable way. With Go test tools, we can develop automated pipelines to test and build our applications.

We’ve used Go to build several command-line applications in this course. We started with a basic word counter, added new skills, and worked up to building a fully featured terminal user interface application persisting data into a database. We developed applications that deal with files and the file system, applications that read data from CSV files, and tools that launch and control external programs. We built a REST API server and a client tool to communicate with it, we used the Cobra framework to improve our tools and handle command-line arguments, and we connected to databases and built an entire terminal user experience. And we did it all while applying techniques to improve their performance, using interfaces and other Go features to develop flexible and maintainable code, and ensuring our tools are well-tested and functional.

You can now use the skills you acquired in this course to build other command-line applications. In addition, these skills provide a foundation for developing many other applications in Go, such as API servers and web applications. Go is an open-source project backed by a growing and vibrant community. As you continue your journey in learning Go, you can ask for help in one of the many channels available on the official “Get Help” page.

Get hands-on with 1200+ tech skills courses.