Commit fb64e0c
committed
refactor: refactor template loading to use helper functions and add tests
- Refactor `LoadTemplates` to utilize the new `loadTemplatesFromFS` helper function.
- Remove complex logic from `LoadTemplates` function.
- Introduce new `LoadTemplatesFromDir` function for loading templates from a directory.
- Create helper function `loadTemplatesFromFS` to handle loading templates from the filesystem.
- Add test for `LoadTemplates` to verify loading templates from an embedded filesystem.
- Add new embedded filesystem sample template in tests.
- Change test template name from `test.tmpl` to `foo.tmpl`.
- Create new template file `test.tmpl` with content "Hello, {{.Name}}!".
Signed-off-by: appleboy <[email protected]>1 parent 2a39894 commit fb64e0c
3 files changed
+53
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 71 | + | |
89 | 72 | | |
90 | 73 | | |
| 74 | + | |
| 75 | + | |
91 | 76 | | |
92 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
93 | 84 | | |
94 | 85 | | |
95 | 86 | | |
96 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
97 | 93 | | |
98 | 94 | | |
99 | 95 | | |
100 | 96 | | |
101 | 97 | | |
102 | | - | |
| 98 | + | |
103 | 99 | | |
104 | 100 | | |
105 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments