File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,17 @@ import (
11
11
"text/template"
12
12
)
13
13
14
+ func exists (path string ) (bool , error ) {
15
+ _ , err := os .Stat (path )
16
+ if err == nil {
17
+ return true , nil
18
+ }
19
+ if os .IsNotExist (err ) {
20
+ return false , nil
21
+ }
22
+ return false , err
23
+ }
24
+
14
25
func groupByMulti (entries []* RuntimeContainer , key , sep string ) map [string ][]* RuntimeContainer {
15
26
groups := make (map [string ][]* RuntimeContainer )
16
27
for _ , v := range entries {
@@ -48,6 +59,7 @@ func generateFile(config Config, containers []*RuntimeContainer) bool {
48
59
templatePath := config .Template
49
60
tmpl , err := template .New (filepath .Base (templatePath )).Funcs (template.FuncMap {
50
61
"contains" : contains ,
62
+ "exists" : exists ,
51
63
"groupBy" : groupBy ,
52
64
"groupByMulti" : groupByMulti ,
53
65
"split" : strings .Split ,
You can’t perform that action at this time.
0 commit comments