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 encoding API functions #97

Merged
merged 1 commit into from
Mar 11, 2016
Merged

Add encoding API functions #97

merged 1 commit into from
Mar 11, 2016

Conversation

sethvargo
Copy link
Contributor

The std encoding format is Unmarshal([]byte, interface{}) error.
This naturally lends itself well to being passed readfile or exhausted
reader/buffer.

This is just a rebase of 92 with authorship maintained

The std encoding format is Unmarshal([]byte, interface{}) error.
This naturally lends itself well to being passed readfile or exhausted
reader/buffer.
@sethvargo sethvargo changed the title adds std encoding API fixes #4 Add encoding API functions Mar 10, 2016
@@ -21,6 +21,17 @@ var (
nodeType reflect.Type = findNodeType()
)

// Unmarshal accepts a byte slice as input and writes the
// data to the value pointed to by v.
func Unmarshal(bs []byte, v interface{}) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an argument here for reordering the parameters as in Decode below? Practically it is Decode which doesn't honour the convention but that is in pretty heavy use now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Go has some odd conventions where Unmarshal is data first, but things like io.Copy are destination first. :-\

@jen20
Copy link
Contributor

jen20 commented Mar 11, 2016

LGTM with one minor note!

sethvargo added a commit that referenced this pull request Mar 11, 2016
Add encoding API functions
@sethvargo sethvargo merged commit 78101eb into master Mar 11, 2016
@sethvargo sethvargo deleted the pr-92 branch March 11, 2016 16:58
apparentlymart pushed a commit that referenced this pull request Sep 9, 2019
…d. (#97)

Previously, hclsyntax MissingItemRange() function returned a zero-length
range anchored at the end of the block in question. This commit changes
that to the beginning of the block. In practice, the end of a block is
generally just a "}" and not very useful in error messages.
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.

None yet

4 participants