kisielk/go-hdf5 — pull request #13 by echlebek (2014-02-02 23:43:52+00:00)
Title: Changed the interface of Dataset.Read and other goodies.

Add support for variable-length strings. Add support for reading and writing scalar datasets. Tests for Dataset.Read/Write.

This is a pretty big departure from the original API but I think this is the right way to go. A casual user should be able to do a Dataset.Read() without having to supply any kind of buffer. Then the user can use reflect to figure out what was actually read, if the go type that the Dataset will read into isn't immediately obvious.

Another feature that comes along with this PR is that you can actually do something like Dataset.Write(5), and write a scalar dataset. This was broken before due to the code trying to address an unaddressable value.

This PR breaks the use-case of reading into a struct, but ReadInto will solve that piece of the puzzle later on when we get around to implementing it.

Finally, variable length strings are now supported by way of reading them into a *C.char and then converting to a go string. This means copying the string, so I'm hoping that in the future we can write a C function to obviate this need.