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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion parser/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,17 @@
// still save this file for debug
lsifFile := filepath.Join(srcDir, "dump.lsif")
lsifWriter, err := os.OpenFile(lsifFile, os.O_WRONLY|os.O_CREATE, 0o666)
defer lsifWriter.Close()
if err != nil {
return nil, err
}

Check warning on line 71 in parser/api.go

View check run for this annotation

Codecov / codecov/patch

parser/api.go#L69-L71

Added lines #L69 - L71 were not covered by tests

err = scip.WriteNDJSON(scip.ElementsToJsonElements(lsifIndex), lsifWriter)
if err != nil {
_ = lsifWriter.Close()
return nil, err
}

Check warning on line 77 in parser/api.go

View check run for this annotation

Codecov / codecov/patch

parser/api.go#L74-L77

Added lines #L74 - L77 were not covered by tests

err = lsifWriter.Close()

Check warning on line 79 in parser/api.go

View check run for this annotation

Codecov / codecov/patch

parser/api.go#L79

Added line #L79 was not covered by tests
if err != nil {
return nil, err
}
Expand Down