Skip to content

fix: the PostgreSQL wrapper is incorrectly generated due to whitespace#10

Merged
kalbasit merged 1 commit intomainfrom
fix-the-postgresql-wrapper-is
Mar 21, 2026
Merged

fix: the PostgreSQL wrapper is incorrectly generated due to whitespace#10
kalbasit merged 1 commit intomainfrom
fix-the-postgresql-wrapper-is

Conversation

@kalbasit
Copy link
Owner

No description provided.

@kalbasit
Copy link
Owner Author

This change is part of the following stack:

Change managed by git-spice.

@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 subtle but important bug in the code generation process for PostgreSQL database wrappers. By correcting the whitespace trimming logic within a Go template, it ensures that the generated //go:build !js directive for PostgreSQL is formatted correctly, preventing potential build or parsing issues in downstream projects. The change is minimal but crucial for the integrity of the generated code.

Highlights

  • PostgreSQL Wrapper Generation: Fixed an issue where the PostgreSQL wrapper was incorrectly generated due to improper whitespace handling in the Go template.
  • Template Whitespace Control: Adjusted Go template syntax to correctly trim whitespace, ensuring clean code generation for PostgreSQL-specific build tags.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize 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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. 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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request fixes an issue where the generated PostgreSQL wrapper had incorrect whitespace, causing the //go:build tag to be on the same line as another comment. The change correctly separates them. I've added a suggestion to further improve the formatting of the generated code to better align with standard Go style conventions for build tags.

Comment on lines +57 to +60
{{if .Engine.IsPostgres}}
//go:build !js

{{end -}}
{{- end -}}

Choose a reason for hiding this comment

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

medium

While this change fixes the issue of the build tag being on the same line, the resulting generated code will have a blank line before the build tag, which is unconventional. For better adherence to Go styling conventions, it's recommended to place the build tag on the line immediately following the 'generated code' comment, followed by a blank line before the package declaration. This can be achieved by adjusting the template whitespace handling.

Suggested change
{{if .Engine.IsPostgres}}
//go:build !js
{{end -}}
{{- end -}}
{{if .Engine.IsPostgres}}//go:build !js
{{end -}}

@kalbasit kalbasit merged commit 1382536 into main Mar 21, 2026
3 checks passed
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 28.83%. Comparing base (8e54855) to head (11dc441).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #10   +/-   ##
=======================================
  Coverage   28.83%   28.83%           
=======================================
  Files           6        6           
  Lines         697      697           
=======================================
  Hits          201      201           
  Misses        485      485           
  Partials       11       11           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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