cli: NewTopLevelCommand: don't use unnamed assignments

This prevents unexpected bugs if fields are added/moved.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-11-28 13:09:35 +01:00
parent 81c68913e4
commit 36441fc5f6
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 7 additions and 1 deletions

View File

@ -116,7 +116,13 @@ type TopLevelCommand struct {
// NewTopLevelCommand returns a new TopLevelCommand object
func NewTopLevelCommand(cmd *cobra.Command, dockerCli *command.DockerCli, opts *cliflags.ClientOptions, flags *pflag.FlagSet) *TopLevelCommand {
return &TopLevelCommand{cmd, dockerCli, opts, flags, os.Args[1:]}
return &TopLevelCommand{
cmd: cmd,
dockerCli: dockerCli,
opts: opts,
flags: flags,
args: os.Args[1:],
}
}
// SetArgs sets the args (default os.Args[:1] used to invoke the command