cli/command/volumes: minor cleanups: use Println, rename vars
- use Println to print newline instead of custom format - use apiClient instead of client for the API client to prevent shadowing imports. - use dockerCLI with Go's standard camelCase casing. - suppress some errors to make my IDE and linters happier Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
299aae0419
commit
10f5b3f73a
@ -41,17 +41,17 @@ func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
|
||||
return cmd
|
||||
}
|
||||
|
||||
func runRemove(ctx context.Context, dockerCli command.Cli, opts *removeOptions) error {
|
||||
client := dockerCli.Client()
|
||||
func runRemove(ctx context.Context, dockerCLI command.Cli, opts *removeOptions) error {
|
||||
apiClient := dockerCLI.Client()
|
||||
|
||||
var errs []string
|
||||
|
||||
for _, name := range opts.volumes {
|
||||
if err := client.VolumeRemove(ctx, name, opts.force); err != nil {
|
||||
if err := apiClient.VolumeRemove(ctx, name, opts.force); err != nil {
|
||||
errs = append(errs, err.Error())
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(dockerCli.Out(), "%s\n", name)
|
||||
_, _ = fmt.Fprintln(dockerCLI.Out(), name)
|
||||
}
|
||||
|
||||
if len(errs) > 0 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user