Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sqlc.arg('argname') form for named params #351

Merged
merged 4 commits into from
Feb 24, 2020

Conversation

Cyberax
Copy link
Contributor

@Cyberax Cyberax commented Feb 22, 2020

This pacifies static SQL analyzers in IDEs (like GoLand).

@kyleconroy
Copy link
Collaborator

Thanks for the PR.

Can you explain your use of go run? I don’t understand why the Placeholder is needed.

internal/catalog/build.go Outdated Show resolved Hide resolved
@Cyberax
Copy link
Contributor Author

Cyberax commented Feb 24, 2020

Can you explain your use of go run? I don’t understand why the Placeholder is needed.

My trick is to import codegen utilities like sqlc as modules. For this to work I need to make sure they are not optimized away by go mod tidy. This can be done by creating a dummy file (like use.go) that contains import (_ "github.com/kyleconroy/sqlc").

However right now sqlc can't be imported, because Golang compiler detects that there are no Go files in the package ("github.com/kyleconroy/sqlc: module github.com/kyleconroy/sqlc@latest found (v1.0.0), but does not contain package github.com/kyleconroy/sqlc")

A simple placeholder file tricks Go into accepting the "package".

@kyleconroy kyleconroy merged commit 4b756bb into sqlc-dev:master Feb 24, 2020
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.

None yet

2 participants