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

Add additional fields support to codegen/features #591

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

muXxer
Copy link
Collaborator

@muXxer muXxer commented Oct 20, 2023

This PR adds support for additional fields in the features codegen.

For example the command:

//go:generate go run github.com/iotaledger/hive.go/codegen/features/cmd@develop identifier.tmpl ../identifier_anchor.gen.go AnchorID a "chainid" "AddressType=AnchorAddress"

and in the template:

func ({{.Receiver}} {{.Name}}) ToAddress() ChainAddress {
	var addr {{.AddressType}}
	copy(addr[:], a[:])

	return &addr
}

would result in:

func (a AnchorID) ToAddress() ChainAddress {
	var addr AnchorAddress
	copy(addr[:], a[:])

	return &addr
}

@muXxer muXxer force-pushed the feat/extend-features-codegen branch from 05aaa55 to ae1f5e3 Compare October 20, 2023 09:59
@muXxer muXxer merged commit 172e93c into develop Oct 20, 2023
52 checks passed
@muXxer muXxer deleted the feat/extend-features-codegen branch October 20, 2023 10: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.

2 participants