Skip to content

Use protobuf getters to access member variables - #5558

Merged
pfi79 merged 1 commit into
hyperledger:mainfrom
bestbeforetoday:protogetter
Sep 10, 2026
Merged

Use protobuf getters to access member variables#5558
pfi79 merged 1 commit into
hyperledger:mainfrom
bestbeforetoday:protogetter

Conversation

@bestbeforetoday

Copy link
Copy Markdown
Member

Use only protobuf getter methods to access member variables on protobuf messages. This protects against panics if accessing members of a nil message, which the getter handles gracefully by returning nil or a default value for a nil receiver.

Use only protobuf getter methods to access member variables on protobuf
messages. This protects against panics if accessing members of a nil
message, which the getter handles gracefully by returning nil or a
default value for a nil receiver.

Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
@pfi79

pfi79 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

have you used protogetter --fix ./... ?

@bestbeforetoday

bestbeforetoday commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

Effectively yes. I used golangci-lint configured with just the protogetter linter and --fix.

I considered adding a simple golangci-lint lint check as part of this change but your golangci-lint change is already in flight so thought it better to wait for that to go in.

@bestbeforetoday
bestbeforetoday marked this pull request as ready for review September 10, 2026 13:10
@bestbeforetoday
bestbeforetoday requested a review from a team as a code owner September 10, 2026 13:10
@pfi79
pfi79 merged commit 007e989 into hyperledger:main Sep 10, 2026
25 of 26 checks passed
@bestbeforetoday
bestbeforetoday deleted the protogetter branch September 10, 2026 13:24
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.

2 participants