From 257c471ff21a31889470f02c1542b437ff633b99 Mon Sep 17 00:00:00 2001 From: Aaron Boodman Date: Sat, 5 Apr 2014 19:34:13 -0700 Subject: [PATCH] Don't rebuild file embeds if they haven't changed. Change-Id: Ia3de5b5dc00341254b76b7adf88bf6038319690e --- make.go | 18 ++++++------------ pkg/fileembed/genfileembed/genfileembed.go | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/make.go b/make.go index 5bff2b523..d01be43ac 100644 --- a/make.go +++ b/make.go @@ -360,19 +360,13 @@ func genEmbeds() error { } // We mark all the zembeds in builddir as wanted, so that we do not // have to regen them next time, unless they need updating. - f, err := os.Open(embeds) - if err != nil { - return err - } - defer f.Close() - names, err := f.Readdirnames(-1) - if err != nil { - return err - } - for _, v := range names { - if strings.HasPrefix(v, "zembed_") { - wantDestFile[filepath.Join(embeds, v)] = true + if err := filepath.Walk(embeds, func(path string, _ os.FileInfo, err error) error { + if strings.HasPrefix(filepath.Base(path), "zembed_") { + wantDestFile[path] = true } + return err + }); err != nil { + return err } } return nil diff --git a/pkg/fileembed/genfileembed/genfileembed.go b/pkg/fileembed/genfileembed/genfileembed.go index 2b2fec2ad..f80ffba6f 100644 --- a/pkg/fileembed/genfileembed/genfileembed.go +++ b/pkg/fileembed/genfileembed/genfileembed.go @@ -108,7 +108,7 @@ func main() { if !genFile() { continue } - log.Printf("Updating %s (package %s)", filepath.Join(dir, embedName), pkgName) + log.Printf("Updating %s (package %s)", embedName, pkgName) bs, err := ioutil.ReadFile(fileName) if err != nil {