Skip to content

Conversation

soroushj
Copy link
Contributor

@soroushj soroushj commented Oct 3, 2020

Fixes #721.

Essentially, I've changed the condition for importing return types (and imports required for their scanning) from !q.Ret.isEmpty() to q.Cmd != ":exec" && !q.Ret.isEmpty().

I've also added a new end-to-end test that fails without this patch.

P.S. I didn't test the Kotlin code generator, but probably it has the same issue (see here and here). But since unused imports are not a compile error in Kotlin, it's not a big issue anyway.

For ":cmd" queries, the return type should not be imported.
Tests the patch for unused imports.
@soroushj soroushj changed the title Fix unused import Fix unused imports for Go generator Oct 3, 2020
@soroushj soroushj changed the title Fix unused imports for Go generator Fix unused imports for Go code generator Oct 3, 2020
@kyleconroy
Copy link
Collaborator

👏 👏 👏

Thank you for:

a) an amazing bug report
b) a pull request to fix it
c) tests
d) all of the above

@kyleconroy kyleconroy merged commit 4cdf5e2 into sqlc-dev:master Oct 4, 2020
@soroushj soroushj deleted the fix-unused-import branch October 4, 2020 07:43
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.

Generated Go code has build errors due to unused imports
2 participants