Skip to content

fix: report reformatted failpoint header instead of panicking - #161

Open
AruneshDwivedi wants to merge 2 commits into
etcd-io:masterfrom
AruneshDwivedi:fix-report-reformatted-failpoint-header
Open

fix: report reformatted failpoint header instead of panicking#161
AruneshDwivedi wants to merge 2 commits into
etcd-io:masterfrom
AruneshDwivedi:fix-report-reformatted-failpoint-header

Conversation

@AruneshDwivedi

Copy link
Copy Markdown

When gofmt reformats a failpoint header across multiple lines, the type assertion lands on a later line than the if. ToComments would panic with index out of range when trying to extract the type from the header line. This fix returns a descriptive error instead, preventing the crash and the wedged .tmp file.

Fixes #158

@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: AruneshDwivedi
Once this PR has been reviewed and has the lgtm label, please assign spzala for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

When gofmt reformats a failpoint header across multiple lines, the type
assertion lands on a later line than the 'if'. ToComments would panic
with index out of range when trying to extract the type from the header
line. Return a descriptive error instead, preventing the crash and the
wedged .tmp file that leaves the tool unusable until manually cleaned up.

Fixes etcd-io#158

Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
@AruneshDwivedi
AruneshDwivedi force-pushed the fix-report-reformatted-failpoint-header branch from 36eed0b to feff108 Compare August 29, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant