Browse code

update go-zfs to last version

Signed-off-by: Alexey Guskov <lexag@mail.ru>

Alexey Guskov authored on 2015/06/02 16:37:38
Showing 6 changed files
... ...
@@ -49,7 +49,7 @@ clone git github.com/go-check/check 64131543e7896d5bcc6bd5a76287eb75ea96c673
49 49
 clone git github.com/gorilla/context 14f550f51a
50 50
 clone git github.com/gorilla/mux e444e69cbd
51 51
 clone git github.com/kr/pty 5cf931ef8f
52
-clone git github.com/mistifyio/go-zfs v2.1.0
52
+clone git github.com/mistifyio/go-zfs v2.1.1
53 53
 clone git github.com/tchap/go-patricia v2.1.0
54 54
 clone hg code.google.com/p/go.net 84a4013f96e0
55 55
 clone hg code.google.com/p/gosqlite 74691fb6f837
... ...
@@ -47,5 +47,14 @@ Push your feature branch to your fork.
47 47
 
48 48
 **Important:** By submitting a patch, you agree to allow the project owners to license your work under the [Apache 2.0 License](./LICENSE).
49 49
 
50
+### Go Tools ###
51
+For consistency and to catch minor issues for all of go code, please run the following:
52
+* goimports
53
+* go vet
54
+* golint
55
+* errcheck
56
+
57
+Many editors can execute the above on save.
58
+
50 59
 ----
51 60
 Guidelines based on http://azkaban.github.io/contributing.html
... ...
@@ -264,7 +264,7 @@ func parseInodeChanges(lines [][]string) ([]*InodeChange, error) {
264 264
 }
265 265
 
266 266
 func listByType(t, filter string) ([]*Dataset, error) {
267
-	args := []string{"get", "all", "-t", t, "-rHp"}
267
+	args := []string{"get", "-rHp", "-t", t, "all"}
268 268
 	if filter != "" {
269 269
 		args = append(args, filter)
270 270
 	}
... ...
@@ -137,7 +137,7 @@ func Volumes(filter string) ([]*Dataset, error) {
137 137
 // GetDataset retrieves a single ZFS dataset by name.  This dataset could be
138 138
 // any valid ZFS dataset type, such as a clone, filesystem, snapshot, or volume.
139 139
 func GetDataset(name string) (*Dataset, error) {
140
-	out, err := zfs("get", "all", "-Hp", name)
140
+	out, err := zfs("get", "-Hp", "all", name)
141 141
 	if err != nil {
142 142
 		return nil, err
143 143
 	}
... ...
@@ -335,7 +335,7 @@ func (d *Dataset) Rollback(destroyMoreRecent bool) error {
335 335
 // A recursion depth may be specified, or a depth of 0 allows unlimited
336 336
 // recursion.
337 337
 func (d *Dataset) Children(depth uint64) ([]*Dataset, error) {
338
-	args := []string{"get", "all", "-t", "all", "-Hp"}
338
+	args := []string{"get", "-t", "all", "-Hp", "all"}
339 339
 	if depth > 0 {
340 340
 		args = append(args, "-d")
341 341
 		args = append(args, strconv.FormatUint(depth, 10))
... ...
@@ -262,8 +262,10 @@ func TestChildren(t *testing.T) {
262 262
 
263 263
 func TestListZpool(t *testing.T) {
264 264
 	zpoolTest(t, func() {
265
-		_, err := zfs.ListZpools()
265
+		pools, err := zfs.ListZpools()
266 266
 		ok(t, err)
267
+		equals(t, "test", pools[0].Name)
268
+
267 269
 	})
268 270
 }
269 271
 
... ...
@@ -292,7 +294,7 @@ func TestRollback(t *testing.T) {
292 292
 		ok(t, err)
293 293
 
294 294
 		err = s1.Rollback(false)
295
-		assert(t, ok != nil, "should error when rolling back beyond most recent without destroyMoreRecent = true")
295
+		assert(t, err != nil, "should error when rolling back beyond most recent without destroyMoreRecent = true")
296 296
 
297 297
 		err = s1.Rollback(true)
298 298
 		ok(t, err)
... ...
@@ -92,9 +92,6 @@ func ListZpools() ([]*Zpool, error) {
92 92
 		return nil, err
93 93
 	}
94 94
 
95
-	// there is no -H
96
-	out = out[1:]
97
-
98 95
 	var pools []*Zpool
99 96
 
100 97
 	for _, line := range out {