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

how to decode a yaml.Node document ? #993

Open
ndeloof opened this issue Sep 26, 2023 · 0 comments · May be fixed by #994
Open

how to decode a yaml.Node document ? #993

ndeloof opened this issue Sep 26, 2023 · 0 comments · May be fixed by #994

Comments

@ndeloof
Copy link

ndeloof commented Sep 26, 2023

I'm running some custom logic to post-process a yaml document as a plain yaml.Node, which I obtain by :

	var nodes yaml.Node
	if err := decoder.Decode(&nodes); ...

but then I have no way to invoke the actual decoder code.

AFAICT Decoder only access the *parser once by calling parse(). Makes me wonder it would sound correct to refactor this so it relies on some Parser interface, so that one can use:

decoder := &Decoder{
		Parser: customParserProducingNodes(),
	}
decoder.Decode(&myStruct)

would this sound good? Happy to prepare a PR for this purpose

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 a pull request may close this issue.

1 participant