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

Fix missing import for external []byte alias #167

Merged
merged 2 commits into from
Jun 28, 2024
Merged

Fix missing import for external []byte alias #167

merged 2 commits into from
Jun 28, 2024

Conversation

ferranbt
Copy link
Owner

Closes #166

// both fixed and dynamic are decoded equally
tmpl := `{{.validate}}if cap(::.{{.name}}) == 0 {
{{if .refName}} ::.{{.name}} = {{ .refName }}(make([]byte, 0, len({{.dst}}))) {{ else }} ::.{{.name}} = make([]byte, 0, len({{.dst}})) {{ end }}
{{if .isRef}} ::.{{.name}} = {{ ref .obj }}(make([]byte, 0, len({{.dst}}))) {{ else }} ::.{{.name}} = make([]byte, 0, len({{.dst}})) {{ end }}
Copy link
Owner Author

Choose a reason for hiding this comment

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

The issue was here, you have to use the new ref function during the template to record the values that need to be imported.

@ferranbt ferranbt merged commit edc73fd into main Jun 28, 2024
1 check passed
olegrok pushed a commit to NilFoundation/fastssz that referenced this pull request Jul 4, 2024
* Fix missing import for external []byte alias

* Remove comment
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.

External reference to []byte type does not import package in generated code
1 participant