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

ReadFile() implementation that works on Windows. #44

Merged
merged 2 commits into from
Feb 12, 2015

Conversation

abourget
Copy link
Contributor

@abourget abourget commented Feb 2, 2015

The Bytes() implementation breaks under Windows. This ReadFile could eventually simply replace it. It also is more similar to the stdlib's ioutil.ReadFile.

@abourget
Copy link
Contributor Author

abourget commented Feb 2, 2015

Sorry, this includes my previous PR (about OpenCloser()) .. it was to simplify my workflow! thanks :)

@GeertJohan
Copy link
Owner

Why isn't Bytes() working for you? An error or panic?

@GeertJohan
Copy link
Owner

Sorry, missed #45.

@GeertJohan
Copy link
Owner

I would like to see if Bytes() can be fixed, before adding a new method that essentially does the same..

@abourget
Copy link
Contributor Author

abourget commented Feb 3, 2015

Is there any optimization that Bytes() does that ReadFile misses ?

@mattn mattn mentioned this pull request Feb 5, 2015
@abourget
Copy link
Contributor Author

abourget commented Feb 6, 2015

can we just swap the functions ? ReadFile() works in all conditions, where Bytes() crashes on Windows.

@abourget
Copy link
Contributor Author

Ok, I've updated this PR to simply replace Bytes. Doesn't change semantics at all.

thanks!

@GeertJohan
Copy link
Owner

Thanks!

GeertJohan pushed a commit that referenced this pull request Feb 12, 2015
`ReadFile()` implementation that works on Windows.
@GeertJohan GeertJohan merged commit bdcc5f0 into GeertJohan:master Feb 12, 2015
@GeertJohan
Copy link
Owner

I've actually also updated box.String() to use box.Bytes() when the data is not embedded.
(For embedded, there is no allocation required, it can just return the pointer to the embedded string)

@abourget abourget deleted the read-file branch February 12, 2015 17:22
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

2 participants