Make zfs.DatasetPath json.Marshaler and json.Unmarshaler

Had to resort to using pointers to zfs.DatasetPath everywhere... Should
find a better solution for that.
This commit is contained in:
Christian Schwarz
2017-08-06 13:04:29 +02:00
parent 2ce07c9342
commit cba083cadf
11 changed files with 75 additions and 57 deletions

View File

@ -34,7 +34,7 @@ func makeVisitRecorder() (v DatasetPathsVisitor, rec *visitRecorder) {
return
}
func buildForest(paths []DatasetPath) (f *DatasetPathForest) {
func buildForest(paths []*DatasetPath) (f *DatasetPathForest) {
f = NewDatasetPathForest()
for _, p := range paths {
f.Add(p)
@ -44,7 +44,7 @@ func buildForest(paths []DatasetPath) (f *DatasetPathForest) {
func TestDatasetPathForestWalkTopDown(t *testing.T) {
paths := []DatasetPath{
paths := []*DatasetPath{
toDatasetPath("pool1"),
toDatasetPath("pool1/foo/bar"),
toDatasetPath("pool1/foo/bar/looloo"),
@ -70,7 +70,7 @@ func TestDatasetPathForestWalkTopDown(t *testing.T) {
func TestDatasetPathWalkTopDownWorksUnordered(t *testing.T) {
paths := []DatasetPath{
paths := []*DatasetPath{
toDatasetPath("pool1"),
toDatasetPath("pool1/foo/bar/looloo"),
toDatasetPath("pool1/foo/bar"),