To use a custom Go plugin with vacuum, you must compile the plugin as a Go plugin module (.so) and then provide its path to the vacuum binary using the -f flag during linting.
1. Compile the plugin
Navigate to the plugin directory and use go build with the -buildmode=plugin flag, including all necessary source files:
go build -buildmode=plugin boot.go check_single_path.go useless_func.go
2. Compile vacuum
Ensure the main vacuum binary is compiled from the repository root:
go build vacuum.go
3. Run vacuum with the plugin
Use the -f flag to specify the directory containing your compiled plugin. vacuum will automatically locate the .so file within that directory.
./vacuum lint -r <ruleset_path> -f <plugin_directory_path> <target_file_path>
# Compile the plugin
go build -buildmode=plugin boot.go check_single_path.go useless_func.go
# Compile vacuum
cd ../../ && go build vacuum.go
# Run vacuum with the plugin
./vacuum lint -r rulesets/examples/sample-plugin-ruleset.yaml -f plugin/sample /path/to/openapi.yaml