Skip to content

Conversation

wardviaene
Copy link
Contributor

This patch fixes #113

@mosajjal mosajjal self-assigned this Jul 14, 2025
@mosajjal mosajjal requested a review from Copilot July 14, 2025 22:20
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR extends the layerString function to recognize fmt.Stringer implementations on pointer receivers and adds a test for dumping embedded pointer fields.

  • Add pointer‐receiver Stringer detection in layerString
  • Introduce embeddedPointer and embeddingPointer types
  • Add TestDumpEmbeddedPointer to verify pointer field handling

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packet.go Inserted logic in layerString to check for Stringer on the addressable value before falling back to reflection
packet_test.go Defined new pointer‐based structs and TestDumpEmbeddedPointer to validate pointer field dereferencing
Comments suppressed due to low confidence (2)

packet.go:319

  • [nitpick] Consider renaming the variable ptr to something more descriptive like addrVal or addr to clarify that this is an addressable reflect.Value, not a raw pointer.
			ptr := v.Addr()

packet.go:317

  • The new pointer‐receiver Stringer detection logic isn't covered by existing tests. Add a test for a type that implements fmt.Stringer only on its pointer receiver to verify this branch.
	if v.CanInterface() {

@mosajjal mosajjal merged commit 578eb20 into gopacket:master Jul 21, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

panic when dumping some RadioTap packets
2 participants