kvdb/sqlbase: fix non-constant format strings#10793
Conversation
When updating the Go version in kvdb to >= 1.24, schema.go no longer compiles due to non-constant format strings. This is invisible until: - a new version of kvdb is tagged and imported in consumers - kvdb is redirected to the local copy This commit fixes the bug.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a compilation issue introduced by Go 1.24, which enforces stricter checks on format strings used in fmt.Sprintf. By refactoring the SQL schema generation logic to use explicit format specifiers, the changes ensure that the package remains compatible with the latest Go toolchain while maintaining existing functionality. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request modifies the SQL schema and table creation commands in kvdb/sqlbase/schema.go by wrapping string concatenations within fmt.Sprintf calls using a %s format specifier. The review feedback correctly identifies that these fmt.Sprintf calls are redundant and less idiomatic than direct string assignment or concatenation. It is recommended to simplify the code by removing the unnecessary function calls while maintaining consistent spacing around operators.
🟡 PR Severity: MEDIUM
🟡 Medium (1 file)
AnalysisThis PR modifies a single file in the No severity bump rules apply:
A focused review by a knowledgeable engineer familiar with the kvdb/SQL backend is appropriate. To override, add a |
ziggie1984
left a comment
There was a problem hiding this comment.
LGTM, I don't think release notes are necessary here
Change Description
When updating the Go version in kvdb to >= 1.24, schema.go no longer compiles due to non-constant format strings. This is invisible until:
This commit fixes the bug. I'm happy to add a release note to either the 0.21 or 0.22 version depending on when people want to merge this.
Steps to Test
In the top-level
go.modfile, add a KVDB redirect:Run
make unit dbbackend=postgresbefore and after this change. Before the change, you should get two errors similar to this:After the change, the bug should be fixed.
Pull Request Checklist
Testing
Code Style and Documentation
[skip ci]in the commit message for small changes.📝 Please see our Contribution Guidelines for further guidance.