MCPcopy Index your code
hub / github.com/coder/coder / dirHasExt

Function dirHasExt

provisionersdk/archive.go:22–37  ·  view source on GitHub ↗
(dir string, exts ...string)

Source from the content-addressed store, hash-verified

20)
21
22func dirHasExt(dir string, exts ...string) (bool, error) {
23 dirEnts, err := os.ReadDir(dir)
24 if err != nil {
25 return false, err
26 }
27
28 for _, fi := range dirEnts {
29 for _, ext := range exts {
30 if strings.HasSuffix(fi.Name(), ext) {
31 return true, nil
32 }
33 }
34 }
35
36 return false, nil
37}
38
39func DirHasLockfile(dir string) (bool, error) {
40 return dirHasExt(dir, ".terraform.lock.hcl")

Callers 2

DirHasLockfileFunction · 0.85
TarFunction · 0.85

Calls 2

ReadDirMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected