You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CamelCase function in protoc-gen-go treats the boundary between letters and digits as a word boundary: when a letter follows a digit, that letter is capitalized.
However, protoc-gen-go-errors does not. It should be the same as the one used in protoc-gen-go, rather than rolling its own version; otherwise, it will lead to inconsistencies.
// Code generated by protoc-gen-go. DO NOT EDIT.const (
Neo4JErrorReason_UNKNOWN_ERRORNeo4JErrorReason=0Neo4JErrorReason_INVALID_CONFIGNeo4JErrorReason=1Neo4JErrorReason_CONNECTION_FAILEDNeo4JErrorReason=2Neo4JErrorReason_NO_RECORDS_AFFECTEDNeo4JErrorReason=3
)
error_errors.pb.go
// Code generated by protoc-gen-go-errors. DO NOT EDIT.
return e.Reason == Neo4jErrorReason_UNKNOWN_ERROR.String() && e.Code == 500
return e.Reason == Neo4jErrorReason_INVALID_CONFIG.String() && e.Code == 404
...
What you expected to happen:
How to reproduce it (as minimally and precisely as possible):
Hello @xiak! 👋 I'm Dosu, your friendly bot here to help you tackle bugs, answer questions, and guide you on your journey to becoming a contributor. I'm ready to assist you while you wait for a human maintainer!
To address the CamelCase naming mismatch between protoc-gen-go-errors and protoc-gen-go, you can modify the case2Camel function in the cmd/protoc-gen-go-errors/errors.go file to align with the behavior of the CamelCase function used in protoc-gen-go. The case2Camel function currently does not treat digits as word boundaries, which leads to inconsistencies like the ones you've observed.
Here's a brief overview of what you can do:
Review the case2Camel function: This function is responsible for converting names to CamelCase in protoc-gen-go-errors. You can find it in the errors.go file of the Kratos framework.
Align with protoc-gen-go: Ensure that the case2Camel function treats digits as word boundaries, similar to the CamelCase function in protoc-gen-go. This means capitalizing the letter following a digit.
Testing: After making changes, verify the behavior with existing tests or add new tests to ensure the function behaves as expected.
By making these adjustments, you can achieve consistent CamelCase naming across both protoc-gen-go and protoc-gen-go-errors[1].
Uh oh!
There was an error while loading. Please reload this page.
What happened:
The CamelCase function in
protoc-gen-go
treats the boundary between letters and digits as a word boundary: when a letter follows a digit, that letter is capitalized.However,
protoc-gen-go-errors
does not. It should be the same as the one used in protoc-gen-go, rather than rolling its own version; otherwise, it will lead to inconsistencies.It will result in the following issues:
protoc-gen-go: Neo4JErrorReason_
error_errors.pb.go: Neo4jErrorReason_
error.pb.go
error_errors.pb.go
What you expected to happen:
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
In protoc-gen-go-errors, the camel‑case algorithm
In protoc-gen-go, the camel‑case algorithm
Environment:
kratos -v
): kratos version v2.8.4go version
): go version go1.24.3 windows/amd64cat /etc/os-release
): win/liunxThe text was updated successfully, but these errors were encountered: