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

[store] if store.json is empty, don't try to unmarshal it #177

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

ryantm
Copy link
Collaborator

@ryantm ryantm commented Dec 11, 2023

Why

  • We're seeing many error logs with

store.json: unexpected end of JSON input

  • Looking at the Repls, it appears they have an empty store.json file

What changed

  • If the store.json file is empty, skip unmarshalling and assume it is empty

Test plan

  • ran UPM_STORE=store.json ./result/bin/upm -l nodejs add express with an empty store.json file before and after the change

@ryantm ryantm requested a review from a team as a code owner December 11, 2023 21:59
@ryantm ryantm requested review from masad-frost and removed request for a team December 11, 2023 21:59
internal/store/store.go Outdated Show resolved Hide resolved
Copy link
Contributor

@cdmistman cdmistman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, thanks!

Why
===
* We're seeing many error logs with

> store.json: unexpected end of JSON input

* Looking at the Repls, it appears they have an empty store.json file

What changed
===
* If the store.json file is empty or only whitespace, skip
unmarshalling and assume it is empty

Test plan
===
* ran `UPM_STORE=store.json ./result/bin/upm -l nodejs add express` with an empty store.json file before and after the change
@ryantm ryantm merged commit d8ad57a into main Dec 12, 2023
1 check passed
@ryantm ryantm deleted the rtm-12-11-empty-store.json branch December 12, 2023 15:47
@blast-hardcheese blast-hardcheese added the bug Something isn't working label Dec 19, 2023
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

Successfully merging this pull request may close these issues.

3 participants