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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

entc/gen/template: add GoLand annotation for template data-types #1444

Merged
merged 2 commits into from Apr 9, 2021

Conversation

a8m
Copy link
Member

@a8m a8m commented Apr 9, 2021

馃く 馃く 馃く 馃く 馃く 馃く 馃く 馃く 馃く 馃く 馃く 馃く 馃く 馃く
This annotation enables the auto-completion of templates in GoLand.

image

@a8m a8m requested a review from rotemtam April 9, 2021 10:10
@a8m
Copy link
Member Author

a8m commented Apr 9, 2021

cc @alexsn

@@ -17,7 +19,7 @@ import (
"entgo.io/ent/dialect/sql"
)

{{ range $_, $n := $.Nodes -}}
{{ range $n := $.Nodes -}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

hey @a8m, I believe this fix is wrong. See: https://play.golang.org/p/TXAOkWN43pp

Screen Shot 2021-04-09 at 17 57 47

Copy link
Member Author

Choose a reason for hiding this comment

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

The range clause works a bit different in templates (see the text/template doc):

Note that if there is only one variable, it is assigned the element; this is opposite to the convention in Go range clauses.

But I still appreciate the review. Thanks 馃檹

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, I have checked the doc but missed the note. :)))

@a8m a8m merged commit 106dd53 into master Apr 9, 2021
@a8m a8m deleted the template/goland-annotation branch April 9, 2021 14:53
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