Search⌘ K

Updating the Pipeline

Explore how to enhance a Go command-line pipeline by adding a test step that uses the go test command. Understand the creation and placement of test files, updating the run function to include the test step, and how the pipeline handles build failures and test success. This lesson helps you automate testing within your Go CLI applications to ensure reliability and maintainability.

We’ve structured our code so we can add more steps to the pipeline by instantiating a new step and adding it to the pipeline slice. According to the initial plan, the next step in the pipeline is the execution of tests using the go test command. But before we add that step, we add a test file with a single test case to the add package we’re using for testing.

Let’s switch to the subdirectory testdata/tool, where we have the file add.go:

 ...