-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
GoTestCompile not always deleting created test-binary with Neovim #907
Comments
I can reproduce this too:
Note: |
Thanks @Limdi for the report. I'm looking into it. @nightlyone unfortunately |
Thanks for the feedback. This issue is now fixed both for Vim and NeoVim. Please pull the latest HEAD of the master branch. Thanks. |
Wonderfull, thanks you fatih! |
I'm still having this issue with vim 8.0, vim-go v1.11 installed via Vundle and this config which I basically copied from the tutorial:
I verified that my version has 1457e6e. |
Still happenning to me as well. |
I'm using vim 8.0.95 and vim-go 1.12. The issue is still happening. |
So I think the problem only happens when the current working directory is not the base directory of the test file. I can easily reproduce the problem by running the following commands:
However, check what happens when the current directory is mypkg:
|
This change improves the way we compile a Go test. Previously we would build a test binary to catch any build errors. A callback was then responsible to delete the test binary after showing build errors (if there were any). This could be racy though, because if the tests lasts long and we quit early, the callback to clean the binary file would never run. So we would end up with artifacts in our working directory. To fix the issue we're going to tell to the `go` tool to run a specific, unique function. We're passing a unique identifier as a function name (which is a randomly generated). This will cause the go tool to build the test file and then try to run the test function. Because there is no such test function, it'll silently quit with zero exit status. As a side effect it'll compile the test file, so we're able to catch any build errors (if any) fixes #907
This change improves the way we compile a Go test. Previously we would build a test binary to catch any build errors. A callback was then responsible to delete the test binary after showing build errors (if there were any). This could be racy though, because if the tests lasts long and we quit early, the callback to clean the binary file would never run. So we would end up with artifacts in our working directory. To fix the issue we're going to tell to the `go` tool to run a specific, unique function. We're passing a unique identifier as a function name (which is a randomly generated). This will cause the go tool to build the test file and then try to run the test function. Because there is no such test function, it'll silently quit with zero exit status. As a side effect it'll compile the test file, so we're able to catch any build errors (if any) fixes #907
This change improves the way we compile a Go test. Previously we would build a test binary to catch any build errors. A callback was then responsible to delete the test binary after showing build errors (if there were any). This could be racy though, because if the tests lasts long and we quit early, the callback to clean the binary file would never run. So we would end up with artifacts in our working directory. To fix the issue we're going to tell to the `go` tool to run a specific, unique function. We're passing a unique identifier as a function name (which is a randomly generated), i.e: ``` go test -run "F97CC94D-4414-41CF-A185-A077F645DF24" testing: warning: no tests to run PASS ok demo 0.006s ``` This will cause the go tool to build the test file and then try to run the test function. Because there is no such test function, it'll silently quit with zero exit status. As a side effect it'll compile the test file, so we're able to catch any build errors (if any) fixes #907
@rafael84 please pull the latest master. We don't produce a test file anymore. |
Awesome, thanks fatih. |
Hi,
#879 said GoTestCompile removes its created test-binaries which works fine working on go-files in the same directory, I'd love to see this removing of the test-binary incase it got created in another directory too.
Actual behavior
For me it reproduces nicely for other directories too
Expected behavior
Configuration
Add here your current configuration and additional information that might be
useful, such as:
vimrc
you used to reproduceThe text was updated successfully, but these errors were encountered: