The most obvious use case is when one wants to make sure as fast
as possible that a command is a valid Dockerfile command.
Signed-off-by: kargakis <kargakis@users.noreply.github.com>
| ... | ... |
@@ -19,19 +19,19 @@ const ( |
| 19 | 19 |
) |
| 20 | 20 |
|
| 21 | 21 |
// Commands is list of all Dockerfile commands |
| 22 |
-var Commands = []string{
|
|
| 23 |
- Env, |
|
| 24 |
- Maintainer, |
|
| 25 |
- Add, |
|
| 26 |
- Copy, |
|
| 27 |
- From, |
|
| 28 |
- Onbuild, |
|
| 29 |
- Workdir, |
|
| 30 |
- Run, |
|
| 31 |
- Cmd, |
|
| 32 |
- Entrypoint, |
|
| 33 |
- Expose, |
|
| 34 |
- Volume, |
|
| 35 |
- User, |
|
| 36 |
- Insert, |
|
| 22 |
+var Commands = map[string]struct{}{
|
|
| 23 |
+ Env: {},
|
|
| 24 |
+ Maintainer: {},
|
|
| 25 |
+ Add: {},
|
|
| 26 |
+ Copy: {},
|
|
| 27 |
+ From: {},
|
|
| 28 |
+ Onbuild: {},
|
|
| 29 |
+ Workdir: {},
|
|
| 30 |
+ Run: {},
|
|
| 31 |
+ Cmd: {},
|
|
| 32 |
+ Entrypoint: {},
|
|
| 33 |
+ Expose: {},
|
|
| 34 |
+ Volume: {},
|
|
| 35 |
+ User: {},
|
|
| 36 |
+ Insert: {},
|
|
| 37 | 37 |
} |
| ... | ... |
@@ -4836,7 +4836,7 @@ func TestBuildMissingArgs(t *testing.T) {
|
| 4836 | 4836 |
|
| 4837 | 4837 |
defer deleteAllContainers() |
| 4838 | 4838 |
|
| 4839 |
- for _, cmd := range command.Commands {
|
|
| 4839 |
+ for cmd := range command.Commands {
|
|
| 4840 | 4840 |
cmd = strings.ToUpper(cmd) |
| 4841 | 4841 |
if _, ok := skipCmds[cmd]; ok {
|
| 4842 | 4842 |
continue |