Skip to content

Go type generation emits invalid struct tags for backtick column names #1125

Description

@hsusul

Bug

PostgreSQL quoted identifiers can contain backticks. The Go type generator currently embeds column names directly in a raw struct-tag literal, so a column such as badtagterminates the literal early and produces Go source thatgofmt` cannot parse.

Reproduction

Generate Go types for a table containing a column whose name includes a backtick, then pipe the generated source to gofmt. It fails with syntax errors including expected semicolon and string literal not terminated.

Expected behavior

The generated struct tag should preserve the PostgreSQL column name while remaining valid Go source. Ordinary column names should retain their current output.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions