Skip to content

Commit

Permalink
builder: Adjust usage of shlex.ProcessWord
Browse files Browse the repository at this point in the history
1b1c5bc08ad81add007eb647e66ed0929693f3a0 extended the function signature
with one additional return value.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
  • Loading branch information
vvoland committed May 13, 2024
1 parent e50f13e commit c3a6c6e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion builder/dockerfile/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ func processMetaArg(meta instructions.ArgCommand, shlex *shell.Lex, args *BuildA
// shell.Lex currently only support the concatenated string format
envs := convertMapToEnvList(args.GetAllAllowed())
if err := meta.Expand(func(word string) (string, error) {
return shlex.ProcessWord(word, envs)
newword, _, err := shlex.ProcessWord(word, envs)
return newword, err
}); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion builder/dockerfile/dispatchers.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (d *dispatchRequest) getExpandedString(shlex *shell.Lex, str string) (strin
substitutionArgs = append(substitutionArgs, key+"="+value)
}

name, err := shlex.ProcessWord(str, substitutionArgs)
name, _, err := shlex.ProcessWord(str, substitutionArgs)
if err != nil {
return "", err
}
Expand Down
3 changes: 2 additions & 1 deletion builder/dockerfile/evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ func dispatch(ctx context.Context, d dispatchRequest, cmd instructions.Command)

if ex, ok := cmd.(instructions.SupportsSingleWordExpansion); ok {
err := ex.Expand(func(word string) (string, error) {
return d.shlex.ProcessWord(word, envs)
newword, _, err := d.shlex.ProcessWord(word, envs)
return newword, err
})
if err != nil {
return errdefs.InvalidParameter(err)
Expand Down

0 comments on commit c3a6c6e

Please sign in to comment.