In this guide, you will learn how to create a simple plugin that can build Go applications; we will walkthrough all the
steps needed to make a Waypoint plugin.
The plugin you are going create will implement the Builder component and will be able to compile Go applications from
source and create a compiled binary. In addition to implementing Builder, you will see how to implement the optional
Configurable and ConfigurableNotify interfaces, and how to define output values used in other phases of the life cycle.
To scaffold the new plugin, you can use the template in the example code repository. Open a terminal at this location;
you will see the following structure.
The template implements all components and interfaces for Waypoint plugins; it creates a vanilla base from which you can
build your plugins. Let's copy this template and create a new plugin. To do that, you can use the clone.sh script in
the template folder.
clone.sh requires you to provide three parameters: the name of the new plugin, the destination and the Go module name; let's
create a new plugin called gobuilder in the current repo.
./clone.sh gobuilder ../gobuilder github.com/hashicorp/waypoint-plugin-examples/gobuilder
Created new plugin in../gobuilder
You can build this plugin by running the following commandcd../gobuilder &&make
./clone.sh gobuilder ../gobuilder github.com/hashicorp/waypoint-plugin-examples/gobuilder
Created new plugin in../gobuilder
You can build this plugin by running the following commandcd../gobuilder &&make
The clone script creates the new plugin at the requested path ../gobuilder, let's change to this path to build the plugin.
cd../gobuilder
cd../gobuilder
The gobuilder folder is an exact copy of the template, but all the Go module paths have changed to the package name
you provided to the command. Before starting to modify the plugin, let's check you can build it. When you run the make
command, all the Protocol Buffers used to exchange values between plugin components, and the main plugin binary are
compiled.