Issue with code being overwritten while packaging a plugin

Viewed 21

I followed the guide from https://answer.apache.org/blog/how-to-package-and-deploy-answer-plugins/.
The original answer binary runs correctly as expected, but after rebuilding with the plugins, some of the modified code appears to have been overwritten or replaced unexpectedly.

1. make clean  
2. make ui  
3. make build  (everything works as expected)  

4. ./answer build \
   --with github.com/apache/answer-plugins/search-meilisearch  
   → After this step, the local code changes are missing or not reflected.

Added placeholder for content editor
image.png
After build plugins
image.png

1 Answers

It looks like you are trying to package the plugin in a binary way. So there are two methods you can try to see.
Method 1, try specifying the working directory by setting ANSWER_MODULE.

ANSWER_MODULE=/your-local-answer-source-code-path/answer ./answer build --with .....

Method 2: Specify the plugin you want directly in main.go, and then make build directly to get the binary with the plugin. You don't need to answer build once more.

import (
	answercmd "github.com/apache/answer/cmd"
	_ "github.com/apache/answer-plugins/search-meilisearch"
)