Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

answer build --output with relative path doesn't work #1285

Open
davispuh opened this issue Mar 13, 2025 · 2 comments
Open

answer build --output with relative path doesn't work #1285

davispuh opened this issue Mar 13, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@davispuh
Copy link
Contributor

Describe the bug

Using answer build --output name option binary is not actually created.

To Reproduce

Download and unpack https://github.com/apache/answer/releases/download/v1.4.2/apache-answer-1.4.2-bin-linux-amd64.tar.gz

$ ./answer build --output myanswer --with github.com/apache/answer-plugins/connector-basic
try to build a new answer with plugins:
[...]
[go build -ldflags -X github.com/apache/answer/cmd.Version=1.4.2 -X github.com/apache/answer/cmd.Revision=0fd7e81 -X github.com/apache/answer/cmd.Time=2025-02-06T08:31:57Z -o myanswer .]
build new answer successfully myanswer
$ ls -la
// there is no `myanswer`

If I don't specify --output parameter or if I specify full path --output /tmp/myanswer then it works.

Expected behavior

myanswer to exist

Platform

  • Device: Desktop
  • OS: Arch Linux
  • Browser and version: N/A
  • Version: 1.4.2 (revision: 0fd7e81)
@davispuh davispuh added the bug Something isn't working label Mar 13, 2025
@LinkinStars
Copy link
Member

Let me explain it. When build new answer with plugin, it will create a dir firstly, such like answer_build1980106637. All following command will be execute in this temp dir. So if you use the relative path, such as ./new_answer, the new binary will be put to answer_build1980106637/new_answer. After building the temp dir will be removed, so the binary will be clean too. In order not to cause misunderstanding, it is better to use the absolute path directly to ensure the correct output of the product.

BTW, A simpler way is as follows

./answer build --output ${PWD}/new_answer

@davispuh
Copy link
Contributor Author

That's totally unintuitive, no one would use absolute path without knowing about this issue. At first I thought that --output didn't work at all and only later I realized it works with absolute path.
So I would say that's just workaround to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants