@@ -109,8 +109,8 @@ func validateExternalNetworks(ctx context.Context, apiClient client.NetworkAPICl
109109 return nil
110110}
111111
112- func createSecrets (ctx context.Context , dockerCli command.Cli , secrets []swarm.SecretSpec ) error {
113- apiClient := dockerCli .Client ()
112+ func createSecrets (ctx context.Context , dockerCLI command.Cli , secrets []swarm.SecretSpec ) error {
113+ apiClient := dockerCLI .Client ()
114114
115115 for _ , secretSpec := range secrets {
116116 secret , _ , err := apiClient .SecretInspectWithRaw (ctx , secretSpec .Name )
@@ -122,7 +122,7 @@ func createSecrets(ctx context.Context, dockerCli command.Cli, secrets []swarm.S
122122 }
123123 case errdefs .IsNotFound (err ):
124124 // secret does not exist, then we create a new one.
125- fmt .Fprintf ( dockerCli .Out (), "Creating secret %s \n " , secretSpec .Name )
125+ _ , _ = fmt .Fprintln ( dockerCLI .Out (), "Creating secret" , secretSpec .Name )
126126 if _ , err := apiClient .SecretCreate (ctx , secretSpec ); err != nil {
127127 return fmt .Errorf ("failed to create secret %s: %w" , secretSpec .Name , err )
128128 }
@@ -133,8 +133,8 @@ func createSecrets(ctx context.Context, dockerCli command.Cli, secrets []swarm.S
133133 return nil
134134}
135135
136- func createConfigs (ctx context.Context , dockerCli command.Cli , configs []swarm.ConfigSpec ) error {
137- apiClient := dockerCli .Client ()
136+ func createConfigs (ctx context.Context , dockerCLI command.Cli , configs []swarm.ConfigSpec ) error {
137+ apiClient := dockerCLI .Client ()
138138
139139 for _ , configSpec := range configs {
140140 config , _ , err := apiClient .ConfigInspectWithRaw (ctx , configSpec .Name )
@@ -146,7 +146,7 @@ func createConfigs(ctx context.Context, dockerCli command.Cli, configs []swarm.C
146146 }
147147 case errdefs .IsNotFound (err ):
148148 // config does not exist, then we create a new one.
149- fmt .Fprintf ( dockerCli .Out (), "Creating config %s \n " , configSpec .Name )
149+ _ , _ = fmt .Fprintln ( dockerCLI .Out (), "Creating config" , configSpec .Name )
150150 if _ , err := apiClient .ConfigCreate (ctx , configSpec ); err != nil {
151151 return fmt .Errorf ("failed to create config %s: %w" , configSpec .Name , err )
152152 }
@@ -157,8 +157,8 @@ func createConfigs(ctx context.Context, dockerCli command.Cli, configs []swarm.C
157157 return nil
158158}
159159
160- func createNetworks (ctx context.Context , dockerCli command.Cli , namespace convert.Namespace , networks map [string ]network.CreateOptions ) error {
161- apiClient := dockerCli .Client ()
160+ func createNetworks (ctx context.Context , dockerCLI command.Cli , namespace convert.Namespace , networks map [string ]network.CreateOptions ) error {
161+ apiClient := dockerCLI .Client ()
162162
163163 existingNetworks , err := getStackNetworks (ctx , apiClient , namespace .Name ())
164164 if err != nil {
@@ -179,17 +179,17 @@ func createNetworks(ctx context.Context, dockerCli command.Cli, namespace conver
179179 createOpts .Driver = defaultNetworkDriver
180180 }
181181
182- fmt .Fprintf ( dockerCli .Out (), "Creating network %s \n " , name )
182+ _ , _ = fmt .Fprintln ( dockerCLI .Out (), "Creating network" , name )
183183 if _ , err := apiClient .NetworkCreate (ctx , name , createOpts ); err != nil {
184184 return fmt .Errorf ("failed to create network %s: %w" , name , err )
185185 }
186186 }
187187 return nil
188188}
189189
190- func deployServices (ctx context.Context , dockerCli command.Cli , services map [string ]swarm.ServiceSpec , namespace convert.Namespace , sendAuth bool , resolveImage string ) ([]string , error ) {
191- apiClient := dockerCli .Client ()
192- out := dockerCli .Out ()
190+ func deployServices (ctx context.Context , dockerCLI command.Cli , services map [string ]swarm.ServiceSpec , namespace convert.Namespace , sendAuth bool , resolveImage string ) ([]string , error ) {
191+ apiClient := dockerCLI .Client ()
192+ out := dockerCLI .Out ()
193193
194194 existingServices , err := getStackServices (ctx , apiClient , namespace .Name ())
195195 if err != nil {
@@ -212,14 +212,14 @@ func deployServices(ctx context.Context, dockerCli command.Cli, services map[str
212212
213213 if sendAuth {
214214 // Retrieve encoded auth token from the image reference
215- encodedAuth , err = command .RetrieveAuthTokenFromImage (dockerCli .ConfigFile (), image )
215+ encodedAuth , err = command .RetrieveAuthTokenFromImage (dockerCLI .ConfigFile (), image )
216216 if err != nil {
217217 return nil , err
218218 }
219219 }
220220
221221 if service , exists := existingServiceMap [name ]; exists {
222- fmt .Fprintf (out , "Updating service %s (id: %s)\n " , name , service .ID )
222+ _ , _ = fmt .Fprintf (out , "Updating service %s (id: %s)\n " , name , service .ID )
223223
224224 updateOpts := types.ServiceUpdateOptions {EncodedRegistryAuth : encodedAuth }
225225
@@ -259,12 +259,12 @@ func deployServices(ctx context.Context, dockerCli command.Cli, services map[str
259259 }
260260
261261 for _ , warning := range response .Warnings {
262- fmt .Fprintln (dockerCli .Err (), warning )
262+ _ , _ = fmt .Fprintln (dockerCLI .Err (), warning )
263263 }
264264
265265 serviceIDs = append (serviceIDs , service .ID )
266266 } else {
267- fmt .Fprintf (out , "Creating service %s \n " , name )
267+ _ , _ = fmt .Fprintln (out , "Creating service" , name )
268268
269269 createOpts := types.ServiceCreateOptions {EncodedRegistryAuth : encodedAuth }
270270
0 commit comments