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 panic for fixBrokenRepoUnits16961 #30068

Merged
merged 5 commits into from
Mar 26, 2024
Merged
Changes from 3 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
2 changes: 2 additions & 0 deletions services/doctor/fix16961.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ func fixBrokenRepoUnit16961(repoUnit *repo_model.RepoUnit, bs []byte) (fixed boo
if fixed, err := fixIssuesConfig16961(bs, cfg); !fixed {
return false, err
}
case unit.TypeActions:
// action unit is newly added, so skip here
Copy link
Contributor

@wxiaoguang wxiaoguang Mar 25, 2024

Choose a reason for hiding this comment

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

Maybe next time the panic would be caused by "Packages"

image

Copy link
Contributor

@wxiaoguang wxiaoguang Mar 25, 2024

Choose a reason for hiding this comment

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

I do not think the logic still make sense nowadays.

At least, it could first try to decode the JSON, if the decoding fails, then switch repoUnit.Type {} and fix, and keep the old logic.

Because new units shouldn't/couldn't break, and never need to be fixed.

default:
panic(fmt.Sprintf("unrecognized repo unit type: %v", repoUnit.Type))
}
Expand Down
Loading