Conditionally Building the Application

Learn how to seamlessly integrate notifications into the Pomodoro tool using the notify package.

To keep the examples in this chapter clear and easier to follow, copy the existing version of the Pomodoro application you built to a new working environment.

This ensures your application source files will match the description provided in this chapter. If you want to continue developing the Pomodoro application in its original directory, make sure you’re changing the appropriate files and adding new files to the correct path relative to the original directory.

We can continue developing our application from the same point. Because we’re using Go modules, we don’t need to take any extra actions. Go modules will resolve the modules to the current directory for us automatically.

Updating the go.mod file

To use our notify package to send out notifications with the Pomodoro app, we add the dependency to the file go.mod under the subdirectory pomo. Also, because our packages are local only, replace the path to the package pointing it to the local directory with its source code, by using the replace directive:

Get hands-on with 1200+ tech skills courses.