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

Investigate generics usage in parser and engine packages #861

Open
jalseth opened this issue Aug 31, 2023 · 2 comments
Open

Investigate generics usage in parser and engine packages #861

jalseth opened this issue Aug 31, 2023 · 2 comments

Comments

@jalseth
Copy link
Member

jalseth commented Aug 31, 2023

Conftest does a lot of similar operations for the various config languages it supports. It may be possible to implement some of this using generics rather than having the same logic implemented over and over.

cc @boranx

@jalseth
Copy link
Member Author

jalseth commented Aug 31, 2023

A function signature for the parser may look something like func parse[T any](data []byte, unmarshal func([]byte, T) error) (map[string]any, error) { ... }

@boranx
Copy link
Member

boranx commented Sep 8, 2023

yeah, +1 to be using the new form among the parsers.
One caveat is that conftest consumers would need to refactor their code to apply the new form if they depend on parser, still, I think we can mention it in the release notes to spread the change gracefully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants