From f1c9cad3583ce9e2f96519172f67b1866e811c92 Mon Sep 17 00:00:00 2001 From: Dacode45 Date: Fri, 1 Jul 2016 10:40:04 -0500 Subject: [PATCH] info is nil in loader.go `Load()` work around When running hammer build in the mantl-packaging vagrant environment, Hammer panics. For some reason info is nil. I did not look much into the cause. --- hammer/loader.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hammer/loader.go b/hammer/loader.go index 42a2aeb..ad39cb2 100644 --- a/hammer/loader.go +++ b/hammer/loader.go @@ -1,11 +1,12 @@ package hammer import ( - "github.com/Sirupsen/logrus" - "github.com/spf13/viper" "io/ioutil" "os" "path/filepath" + + "github.com/Sirupsen/logrus" + "github.com/spf13/viper" ) // Loader looks for Package specs in a given root. @@ -31,7 +32,8 @@ func (l *Loader) Load() ([]*Package, error) { packages := []*Package{} err := filepath.Walk(l.Root, func(pathName string, info os.FileInfo, err error) error { - if info.IsDir() || info.Name() != l.Indicator { + + if info == nil || info.IsDir() || info.Name() != l.Indicator { return nil }