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: close lsif file after writing #70

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

crackcomm
Copy link
Contributor

The dump.lsif contained malformed JSON output, for example:

{"id":139,"type":"vertex","label":"range","start":{"line":4,"character":11},"end":{"line":4,"character":18}}
{"id":140,"type":"edge","label":"next","inV":39,"outV":139}
{"id":141,"type":"edge","label":"item","inVs":[139],"outV":40,"document":124,"property":"references"}
{"id":142,"type":"edge","label":"contains","inVs":[125,129,132,135,139],"outV":124}
"line":4,"character":18}}
{"id":143,"type":"edge","label":"next","inV":39,"outV":142}

This in turn caused warnings and sometimes crashes:

WARN[0000] invalid json format: V":124}
WARN[0000] invalid json format: "line":4,"character":18}}
panic: EOF

goroutine 1 [running]:
main.panicIfErr(...)
        /home/pah/ocxmr-repos/opt/srctx/cmd/srctx/main.go:31
main.mainFunc({0xc0000360a0, 0xa, 0xa})
        /home/pah/ocxmr-repos/opt/srctx/cmd/srctx/main.go:26 +0x145
main.main()
        /home/pah/ocxmr-repos/opt/srctx/cmd/srctx/main.go:13 +0x2e

This hopefully fixes the bug, it does in my limited testing.

The `dump.lsif` contained malformed JSON output, for example:

```
{"id":139,"type":"vertex","label":"range","start":{"line":4,"character":11},"end":{"line":4,"character":18}}
{"id":140,"type":"edge","label":"next","inV":39,"outV":139}
{"id":141,"type":"edge","label":"item","inVs":[139],"outV":40,"document":124,"property":"references"}
{"id":142,"type":"edge","label":"contains","inVs":[125,129,132,135,139],"outV":124}
"line":4,"character":18}}
{"id":143,"type":"edge","label":"next","inV":39,"outV":142}
```

This in turn caused warnings and sometimes crashes:

```
WARN[0000] invalid json format: V":124}
```

```
WARN[0000] invalid json format: "line":4,"character":18}}
panic: EOF

goroutine 1 [running]:
main.panicIfErr(...)
        /home/pah/ocxmr-repos/opt/srctx/cmd/srctx/main.go:31
main.mainFunc({0xc0000360a0, 0xa, 0xa})
        /home/pah/ocxmr-repos/opt/srctx/cmd/srctx/main.go:26 +0x145
main.main()
        /home/pah/ocxmr-repos/opt/srctx/cmd/srctx/main.go:13 +0x2e
```
Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (6e0c5dc) 62.22% compared to head (7f8d606) 64.78%.

Files Patch % Lines
parser/api.go 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #70      +/-   ##
==========================================
+ Coverage   62.22%   64.78%   +2.56%     
==========================================
  Files          48       48              
  Lines        3044     3050       +6     
==========================================
+ Hits         1894     1976      +82     
+ Misses        910      836      -74     
+ Partials      240      238       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@williamfzc williamfzc merged commit b82aa07 into williamfzc:main Nov 27, 2023
2 of 3 checks passed
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