Closed
Description
Version
1.25.0
What happened?
When there are no imports to generate, sqlc
generates two (2) unnecessary lines:
import ()
<blank line>
This is a problem when running this command in CI as gotfmt
will remove that empty import and the blank line that follows:
gofmt -s -w . && git diff --exit-code
This is a simple fix; add a hasImports
method for use by the template and then wrap every place in templates that generate imports with {{ if hasImports .SourceName }}
. After submitting this issue I will submit a PR to fix this issue.
See db/models.go
in playground.
Relevant log output
n/a
Database schema
n/a
SQL queries
n/a
Configuration
n/a
Playground URL
https://play.sqlc.dev/p/d03273b7d19072abdcb608fc72f577628aad25c2e478f7709a07221438da2832
What operating system are you using?
macOS
What database engines are you using?
SQLite
What type of code are you generating?
Go