From 49d64b9a3b6f5b2f0354fa691ccb9808bda584d9 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Sat, 21 Apr 2018 10:47:19 -0400 Subject: Linting subpackages too... (#302) * Linting subpackages too... Signed-off-by: Dave Henderson * Fixing lint issues Signed-off-by: Dave Henderson --- funcs/aws.go | 2 +- funcs/aws_test.go | 4 +++- funcs/crypto.go | 2 ++ funcs/file.go | 4 ++-- funcs/file_test.go | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) (limited to 'funcs') diff --git a/funcs/aws.go b/funcs/aws.go index 1953f8a7..284c46a1 100644 --- a/funcs/aws.go +++ b/funcs/aws.go @@ -35,8 +35,8 @@ func AWSFuncs(f map[string]interface{}) { // Funcs - type Funcs struct { meta *aws.Ec2Meta - metaInit sync.Once info *aws.Ec2Info + metaInit sync.Once infoInit sync.Once awsopts aws.ClientOptions } diff --git a/funcs/aws_test.go b/funcs/aws_test.go index 4d79d7c2..7ae55da1 100644 --- a/funcs/aws_test.go +++ b/funcs/aws_test.go @@ -8,7 +8,9 @@ import ( ) func TestNSIsIdempotent(t *testing.T) { - assert.True(t, AWSNS() == AWSNS()) + left := AWSNS() + right := AWSNS() + assert.True(t, left == right) } func TestFuncs(t *testing.T) { m := aws.NewDummyEc2Meta() diff --git a/funcs/crypto.go b/funcs/crypto.go index ef54ee21..b16833dc 100644 --- a/funcs/crypto.go +++ b/funcs/crypto.go @@ -95,6 +95,7 @@ func (f *CryptoFuncs) SHA512(input interface{}) string { } // SHA512_224 - +// nolint: golint func (f *CryptoFuncs) SHA512_224(input interface{}) string { in := toBytes(input) out := sha512.Sum512_224(in) @@ -102,6 +103,7 @@ func (f *CryptoFuncs) SHA512_224(input interface{}) string { } // SHA512_256 - +// nolint: golint func (f *CryptoFuncs) SHA512_256(input interface{}) string { in := toBytes(input) out := sha512.Sum512_256(in) diff --git a/funcs/file.go b/funcs/file.go index 9d7310ba..7ba2ec40 100644 --- a/funcs/file.go +++ b/funcs/file.go @@ -60,12 +60,12 @@ func (f *FileFuncs) ReadDir(path interface{}) ([]string, error) { // Walk - func (f *FileFuncs) Walk(path interface{}) ([]string, error) { files := make([]string, 0) - afero.Walk(f.fs, conv.ToString(path), func(subpath string, finfo os.FileInfo, err error) error { + err := afero.Walk(f.fs, conv.ToString(path), func(subpath string, finfo os.FileInfo, err error) error { if err != nil { return err } files = append(files, subpath) return nil }) - return files, nil + return files, err } diff --git a/funcs/file_test.go b/funcs/file_test.go index 56651421..393fcef0 100644 --- a/funcs/file_test.go +++ b/funcs/file_test.go @@ -42,10 +42,10 @@ func TestFileWalk(t *testing.T) { f, _ := fs.Create("/tmp/bar/baz/foo") _, _ = f.Write([]byte("foo")) - expectedLists := [][]string{{"tmp"}, {"tmp", "bar" }, {"tmp", "bar", "baz"}, {"tmp", "bar", "baz", "foo"}} + expectedLists := [][]string{{"tmp"}, {"tmp", "bar"}, {"tmp", "bar", "baz"}, {"tmp", "bar", "baz", "foo"}} expectedPaths := make([]string, 0) for _, path := range expectedLists { - expectedPaths = append(expectedPaths, string(filepath.Separator) + filepath.Join(path...)) + expectedPaths = append(expectedPaths, string(filepath.Separator)+filepath.Join(path...)) } actualPaths, err := ff.Walk(string(filepath.Separator) + "tmp") -- cgit v1.2.3