Skip to content

Conversation

@positiveblue
Copy link

Depending on the commands used in your query.sql the copyfrom.go
may end up with unused package imports.

There is a patch for this problem that was merged in the #1386 PR.
However, it looks like some edge cases were left out of the fix.

This commit ensures that buildImports only has copyfrom queries
when called from copyfromImports.

Depending on the commands used in your `query.sql` the `copyfrom.go`
may end up with unused packge imports.

There is a patch for this problem that was merged in the sqlc-dev#1386 PR.
However, it looks like some edge cases were left out of the fix.

This commit ensures that `buildImports` only has `copyfrom` queries
when called from `copyfromImports`.
-- name: InsertSingleValue :exec
INSERT INTO myschema.foo (a) VALUES ($1);

-- name: DeleteValues :execresult
Copy link
Author

Choose a reason for hiding this comment

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

This was the main offender, any file generated from a query file with queries of type metadata.CmdExecResult would include the github.com/jackc/pgconn package

@kyleconroy kyleconroy merged commit 1b6ba1e into sqlc-dev:main May 22, 2022
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