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

fix!: broken 'go list' report on some systems #167

Merged
merged 2 commits into from
Aug 17, 2024
Merged

fix!: broken 'go list' report on some systems #167

merged 2 commits into from
Aug 17, 2024

Conversation

miduddin
Copy link
Contributor

Tests would always be reported as skipped with the "not associated" message.

Not sure how to pinpoint the exact cause of this issue but it happens on my personal setup (WSL Arch with Windows Terminal Canary, if that helps).

go list output from log file before this change:

...
DEBUG | 2024-08-15T21:36:45Z+0700 | ...uddin/code/neotest-golang/lua/neotest-golang/logging.lua:47 | [neotest-golang] Running Go list: go list -json ./... in /home/miduddin/code/test_go
INFO | 2024-08-15T21:36:45Z+0700 | ...uddin/code/neotest-golang/lua/neotest-golang/logging.lua:59 | [neotest-golang] Go list output:  �]9;9;\\wsl.localhost\arch2\home\miduddin\code\test_go�\{ "Dir": "/home/miduddin/code/test_go", "ImportPath": "localhost/testgo", "Name": "main", "Target": "/home/miduddin/.local/share/go/bin/testgo", "Root": "/home/miduddin/code/test_go", "Module": { "Path": "localhost/testgo", "Main": true, "Dir": "/home/miduddin/code/test_go", "GoMod": "/home/miduddin/code/test_go/go.mod", "GoVersion": "1.23.0" }, "Match": [ "./..." ], "Deps": [ "internal/abi", "internal/bytealg", "internal/byteorder", "internal/chacha8rand", "internal/coverage/rtcov", "internal/cpu", "internal/goarch", "internal/godebugs", "internal/goexperiment", "internal/goos", "internal/profilerecord", "internal/runtime/atomic", "internal/runtime/exithook", "internal/runtime/syscall", "internal/stringslite", "runtime", "runtime/internal/math", "runtime/internal/sys", "unsafe" ], "TestGoFiles": [ "main_test.go" ], "TestImports": [ "testing" ] } 
INFO | 2024-08-15T21:36:45Z+0700 | ...uddin/code/neotest-golang/lua/neotest-golang/logging.lua:59 | [neotest-golang] Test command: go test -json -count=1 -race -timeout=10s /home/miduddin/code/test_go -run ^TestStuff$
...

After:

...
DEBUG | 2024-08-15T21:39:58Z+0700 | ...uddin/code/neotest-golang/lua/neotest-golang/logging.lua:47 | [neotest-golang] Running Go list: go list -json /home/miduddin/code/test_go/...
INFO | 2024-08-15T21:39:58Z+0700 | ...uddin/code/neotest-golang/lua/neotest-golang/logging.lua:59 | [neotest-golang] Go list output:  { "Dir": "/home/miduddin/code/test_go", "ImportPath": "localhost/testgo", "Name": "main", "Target": "/home/miduddin/.local/share/go/bin/testgo", "Root": "/home/miduddin/code/test_go", "Module": { "Path": "localhost/testgo", "Main": true, "Dir": "/home/miduddin/code/test_go", "GoMod": "/home/miduddin/code/test_go/go.mod", "GoVersion": "1.23.0" }, "Match": [ "/home/miduddin/code/test_go/..." ], "Deps": [ "internal/abi", "internal/bytealg", "internal/byteorder", "internal/chacha8rand", "internal/coverage/rtcov", "internal/cpu", "internal/goarch", "internal/godebugs", "internal/goexperiment", "internal/goos", "internal/profilerecord", "internal/runtime/atomic", "internal/runtime/exithook", "internal/runtime/syscall", "internal/stringslite", "runtime", "runtime/internal/math", "runtime/internal/sys", "unsafe" ], "TestGoFiles": [ "main_test.go" ], "TestImports": [ "testing" ] } 
INFO | 2024-08-15T21:39:58Z+0700 | ...uddin/code/neotest-golang/lua/neotest-golang/logging.lua:59 | [neotest-golang] Test command: go test -json -count=1 -race -timeout=10s /home/miduddin/code/test_go -run ^TestStuff$
...

P.S. Also not sure if this is the best way to fix the issue, but it seems to work on my machine 😁
Any suggestions would be appreciated.

@miduddin miduddin changed the title fix broken test report on some systems fix: broken test report on some systems Aug 15, 2024
Tests would always be reported as skipped with the "not associated"
message.

Not sure how to pinpoint the exact cause of this issue, but it happens
on WSL Arch with Windows Terminal Canary.
@miduddin
Copy link
Contributor Author

Updated the code for the failing test.

@fredrikaverpil
Copy link
Owner

fredrikaverpil commented Aug 17, 2024

Hey @miduddin and thanks for this nice improvement!

I think it looks great and the only further improvement here would be to add some sort of error handling which would potentially notify about non-existing output or a failed command.

I was actually unaware of vim.system and I understand this is a somewhat recent addition (added in 0.10.0), as vim.fn.system now also recommends turning to this one instead. Given that this plugin was released under 0.9.x I believe this warrants a major bump as there's a chance someone is actually still on 0.9.x using neotest-golang. So I'll just edit your PR title and add the exclamation mark and make this a breaking major bump for clarity.

Many thanks for the addition, I just had a minor comment on error logging! 👍

@fredrikaverpil fredrikaverpil changed the title fix: broken test report on some systems fix!: broken test report on some systems Aug 17, 2024
@fredrikaverpil fredrikaverpil changed the title fix!: broken test report on some systems fix!: broken 'go list' report on some systems Aug 17, 2024
@fredrikaverpil fredrikaverpil merged commit 26d937f into fredrikaverpil:main Aug 17, 2024
10 checks passed
@miduddin miduddin deleted the dev branch August 17, 2024 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants