config/module: walk actually recurses into dirs, don't copy dot-prefix
This commit is contained in:
parent
238ec05f2f
commit
f35ebe7032
|
@ -26,7 +26,7 @@ func copyDir(dst, src string) error {
|
|||
basePath := filepath.Base(path)
|
||||
if strings.HasPrefix(basePath, ".") {
|
||||
// Skip any dot files
|
||||
return nil
|
||||
return filepath.SkipDir
|
||||
}
|
||||
|
||||
dstPath := filepath.Join(dst, basePath)
|
||||
|
@ -38,7 +38,7 @@ func copyDir(dst, src string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
return copyDir(dstPath, path)
|
||||
return nil
|
||||
}
|
||||
|
||||
// If we have a file, copy the contents.
|
||||
|
|
|
@ -60,6 +60,25 @@ func TestGet_fileSubdir(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestGetCopy_dot(t *testing.T) {
|
||||
dst := tempDir(t)
|
||||
u := testModule("basic-dot")
|
||||
|
||||
if err := GetCopy(dst, u); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
mainPath := filepath.Join(dst, "main.tf")
|
||||
if _, err := os.Stat(mainPath); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
mainPath = filepath.Join(dst, "foo.tf")
|
||||
if _, err := os.Stat(mainPath); err == nil {
|
||||
t.Fatal("should not have foo.tf")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetCopy_file(t *testing.T) {
|
||||
dst := tempDir(t)
|
||||
u := testModule("basic")
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
# Hi
|
|
@ -0,0 +1,5 @@
|
|||
# Hello
|
||||
|
||||
module "foo" {
|
||||
source = "./foo"
|
||||
}
|
Loading…
Reference in New Issue