Conditionally Building Your Application

Powerful Command-Line Applications in Go — by Ricardo Gerardi (121 / 127)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Testing the Notify Package | TOC | Cross-Compiling Your Application 👉

To keep the examples in this chapter clear and easier to follow, copy the existing version of your Pomodoro application 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.

Copy the directory pomo from the directory $HOME/pragprog.com/rggo/persistentDataSQL to the current chapter directory recursively, and switch to it:

​ ​$ ​​cp​​ ​​-r​​ ​​$HOME/pragprog.com/rggo/persistentDataSQL/pomo​​ ​​\​
​ ​ ​​$HOME/pragprog.com/rggo/distributing​
​ ​$ ​​cd​​ ​​$HOME/pragprog.com/rggo/distributing/pomo​

Once you switch to the new directory, you can continue developing your application from the same point. Because you’re using Go modules, you don’t need to take any extra actions. Go modules will resolve the modules to the current directory for you automatically.

To use your notify package to send out notifications with the Pomodoro app, add the dependency to the file go.mod under the subdirectory pomo. Also, because your packages are local only, replace…

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.