Update files based on go lint

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-09-29 16:03:09 -04:00
parent 70b353dff2
commit f43b7acfd2
22 changed files with 61 additions and 44 deletions

View File

@@ -1,5 +1,6 @@
package fs
// Usage of disk information
type Usage struct {
Inodes int64
Size int64

View File

@@ -26,12 +26,7 @@ func CreateFile(name string, content []byte, perm os.FileMode) Applier {
if err := ioutil.WriteFile(fullPath, content, perm); err != nil {
return err
}
if err := os.Chmod(fullPath, perm); err != nil {
return err
}
return nil
return os.Chmod(fullPath, perm)
})
}

View File

@@ -4,6 +4,7 @@ package fstest
import "github.com/containerd/continuity/sysx"
// SetXAttr sets the xatter for the file
func SetXAttr(name, key, value string) Applier {
return applyFn(func(root string) error {
return sysx.LSetxattr(name, key, []byte(value), 0)

View File

@@ -7,11 +7,13 @@ import (
"testing"
)
// TestApplier applies the test context
type TestApplier interface {
TestContext(context.Context) (context.Context, func(), error)
Apply(context.Context, Applier) (string, func(), error)
}
// FSSuite runs the path test suite
func FSSuite(t *testing.T, a TestApplier) {
t.Run("Basic", makeTest(t, a, basicTest))
t.Run("Deletion", makeTest(t, a, deletionTest))

View File

@@ -2,7 +2,7 @@ package fs
import "os"
// GetLinkID returns an identifier representing the node a hardlink is pointing
// GetLinkInfo returns an identifier representing the node a hardlink is pointing
// to. If the file is not hard linked then 0 will be returned.
func GetLinkInfo(fi os.FileInfo) (uint64, bool) {
return getLinkInfo(fi)