@@ -15,17 +15,15 @@ const (
15
15
TemplateArchiveLimit = 1 << 20
16
16
)
17
17
18
- func dirHasExt (dir string , exts ... string ) (bool , error ) {
18
+ func dirHasExt (dir string , ext string ) (bool , error ) {
19
19
dirEnts , err := os .ReadDir (dir )
20
20
if err != nil {
21
21
return false , err
22
22
}
23
23
24
24
for _ , fi := range dirEnts {
25
- for _ , ext := range exts {
26
- if strings .HasSuffix (fi .Name (), ext ) {
27
- return true , nil
28
- }
25
+ if strings .HasSuffix (fi .Name (), ext ) {
26
+ return true , nil
29
27
}
30
28
}
31
29
@@ -37,8 +35,8 @@ func Tar(w io.Writer, directory string, limit int64) error {
37
35
tarWriter := tar .NewWriter (w )
38
36
totalSize := int64 (0 )
39
37
40
- tfExts := [] string { ".tf" , ".tf.json" }
41
- hasTf , err := dirHasExt (directory , tfExts ... )
38
+ const tfExt = ".tf"
39
+ hasTf , err := dirHasExt (directory , tfExt )
42
40
if err != nil {
43
41
return err
44
42
}
@@ -52,7 +50,7 @@ func Tar(w io.Writer, directory string, limit int64) error {
52
50
// useless.
53
51
return xerrors .Errorf (
54
52
"%s is not a valid template since it has no %s files" ,
55
- absPath , tfExts ,
53
+ absPath , tfExt ,
56
54
)
57
55
}
58
56
0 commit comments