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

feat(codegen): add support for build tags (#2012) #2807

Merged
merged 5 commits into from
Oct 6, 2023

Conversation

Hyuga-Tsukui
Copy link
Contributor

@Hyuga-Tsukui Hyuga-Tsukui commented Oct 5, 2023

Attempt at adding the feature for #2012.

I am not a native English speaker, so some variable names might not be appropriate.

I've added a new build_tags option, which gets inserted into the template when enabled.

Fixes #2012

Copy link
Collaborator

@kyleconroy kyleconroy left a comment

Choose a reason for hiding this comment

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

Thanks! Only one real change before we can merge this in. Appreciate you adding a test case.

docs/reference/config.md Outdated Show resolved Hide resolved
docs/reference/config.md Outdated Show resolved Hide resolved
internal/codegen/golang/gen.go Outdated Show resolved Hide resolved
Comment on lines 3 to 4
//go:build {{.BuildTags}}
// +build {{.BuildTags}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The // +build syntax has been deprecated since Go 1.17. Let's remove it and only support //go:build.

@@ -78,6 +78,7 @@ message GoCode {
bool emit_result_struct_pointers = 8;
bool emit_params_struct_pointers = 9;
bool emit_methods_with_db_argument = 10;
string build_tags = 29;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add this to the end of the message instead of in the middle?

Hyuga-Tsukui and others added 4 commits October 6, 2023 11:15
Co-authored-by: Kyle Gray <kyle@conroy.org>
Co-authored-by: Kyle Gray <kyle@conroy.org>
Co-authored-by: Kyle Gray <kyle@conroy.org>
@Hyuga-Tsukui
Copy link
Contributor Author

Thank you for the review. I've made the corrections, so please check again.

@kyleconroy kyleconroy merged commit 7dc0e7c into sqlc-dev:main Oct 6, 2023
8 checks passed
This pull request was closed.
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.

Being able to mark generated files with go:build tags
2 participants