8000 add UnmarshalPartially by davidwtf · Pull Request #15 · hjson/hjson-go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

add UnmarshalPartially #15

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add UnmarshalPartially #15

wants to merge 1 commit into from

Conversation

davidwtf
Copy link

In our project, we use hjson as part of configs, it's mixed with other format texts.
So we need read the part of hjson by hjson-go and keep the left part to other programs.
I added the function UnmarshalPartially to do this work.
UnmarshalPartially reads characters from the beginning, add try to parse them as hjson.
It stops when meeting wrong formats or finishing a complete hjson structure.
It returns the parsed value, the start position of the unprocessed part and error if has.

@dqsully
Copy link
Member
dqsully commented Oct 7, 2019

This is a cool feature, but I'm not sure it fits in the official Hjson package. Maybe you could make a config format similar to how OctoberCMS does it?

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
0