Skip to content

fix(pkg/diff): guard reflect.Value.IsNil in isEmptyInterface against non-nillable kinds - #7381

Open
Norway-02 wants to merge 1 commit into
pipe-cd:masterfrom
Norway-02:fix/diff-reflect-nil-guard
Open

Norway-02 wants to merge 1 commit into
pipe-cd:masterfrom
Norway-02:fix/diff-reflect-nil-guard

Conversation

@Norway-02

Copy link
Copy Markdown

What this PR does:
Guards v.IsNil() inside isEmptyInterface in pkg/diff/diff.go so it is only called on nillable reflect.Value kinds (Chan, Func, Map, Pointer, UnsafePointer, Interface, Slice).

Why we need it:
In Go's reflect package, calling Value.IsNil() on non-nillable kinds (Bool, Int, String, Struct, etc.) causes an unhandled runtime panic (reflect: call of reflect.Value.IsNil on ... Value). Adding kind checks before calling v.IsNil() prevents panics when diffing un-wrapped primitive values.

Which issue(s) this PR fixes:
Fixes # NONE

Does this PR introduce a user-facing change?:

  • How are users affected by this change: None
  • Is this breaking change: No
  • How to migrate (if breaking change): N/A

Screenshots/Videos (for documentation or website changes):
N/A

…non-nillable kinds

Signed-off-by: Norway-02 <anshulkhetade02@gmail.com>
@Norway-02
Norway-02 requested a review from a team as a code owner September 15, 2026 04:06
@Norway-02
Norway-02 requested review from ffjlabo, mohammedfirdouss and t-kikuc and a lite review from Copilot September 15, 2026 04:06
@netlify

netlify Bot commented Sep 15, 2026

Copy link
Copy Markdown

Deploy Preview for pipecd-site ready!

Name Link
🔨 Latest commit 6af4cf1
🔍 Latest deploy log https://app.netlify.com/projects/pipecd-site/deploys/6aa8c43b75fb51000844f581
😎 Deploy Preview https://deploy-preview-7381--pipecd-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Norway-02

Copy link
Copy Markdown
Author

cc @mohammedfirdouss @TheRealShek @Warashi - Please review when you get a chance. Thanks!

@TheRealShek

Copy link
Copy Markdown
Contributor

@Norway-02 you donot need to tag me cause i am not an maintainer of this codebase. Happy contributing!

@Norway-02

Copy link
Copy Markdown
Author

Thanks for letting me know @TheRealShek! Appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants