export struct members for signature benchmark#390
Merged
guelfey merged 1 commit intogodbus:masterfrom Sep 21, 2024
Merged
Conversation
i assume unexported fields are skipped on purpose, but computing the signature
of a struct with no exported fields in a benchmark seems sort of pointless and
also panics. export the fields so that we actually compute their signature, and
prevent panic'ing on an empty struct.
fixes:
panic: dbus: invalid type struct { b uint8; i int32; t uint64; s string }
goroutine 12 [running]:
github.com/godbus/dbus/v5.getSignature({0x74c3c0, 0x6bbf60}, 0xc0000aaed8)
/home/mischief/src/go-dbus/sig.go:106 +0xa25
github.com/godbus/dbus/v5.getSignature({0x74c3c0, 0x6822e0}, 0xc0000aaed8)
/home/mischief/src/go-dbus/sig.go:110 +0x60c
github.com/godbus/dbus/v5.SignatureOf({0x8fcb40?, 0xc000193f40?, 0x518452?})
/home/mischief/src/go-dbus/sig.go:37 +0x50
github.com/godbus/dbus/v5.BenchmarkGetSignatureLong(0xc000148788)
/home/mischief/src/go-dbus/sig_test.go:68 +0x36
testing.(*B).runN(0xc000148788, 0x1)
/usr/lib/go/src/testing/benchmark.go:193 +0xf8
testing.(*B).run1.func1()
/usr/lib/go/src/testing/benchmark.go:215 +0x4e
created by testing.(*B).run1 in goroutine 1
/usr/lib/go/src/testing/benchmark.go:208 +0x90
when executing:
go test -v -bench BenchmarkGetSignatureLong -run ^$ .
11521c6 to
d098bdc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
i assume unexported fields are skipped on purpose, but computing the signature of a struct with no exported fields in a benchmark seems sort of pointless and also panics. export the fields so that we actually compute their signature, and prevent panic'ing on an empty struct.
fixes:
when executing: