Commit Graph

1137 Commits

Author SHA1 Message Date
Simon Ferquel 5a12f90b4c
Don't filter out registries to logout from with config file contents
Previously, if a registry AuthInfo was not present in the CLI config file, docker logout could not be used
to ask the credential helper to forget about it. It causes problem for people working with
multiple alternative config files, and it causes problems for cases like Docker Desktop w/ WSL 2, as
it uses the same win32 credential helper as the Windows CLI, but a different config file, leading to
bugs where I cannot logout from a registry from wsl2 if I logged in from Windows and vice-versa.

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
(cherry picked from commit 6248f2fb6f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-06-17 17:32:39 +02:00
Simon Ferquel cfa1fd9acd
Don't loose additional metadata fields
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
(cherry picked from commit 2ab4b4d536)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-06-16 15:31:21 +02:00
Sebastiaan van Stijn 936d328da9
Use consistent name for errors
This prevents inconsistent errors when using a symlink, or when renaming
the binary;

Before this change;

    ln -s $(which docker) toto
    ./toto rune
    docker: 'rune' is not a docker command.

    ./toto run daslkjadslkjdaslkj
    Unable to find image 'adslkjadslakdsj:latest' locally
    ./toto: Error response from daemon: pull access denied for adslkjadslakdsj, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.

After this change:

    ln -s $(which docker) toto
    ./toto rune
    docker: 'rune' is not a docker command.

    ./toto run daslkjadslkjdaslkj
    Unable to find image 'adslkjadslakdsj:latest' locally
    docker: Error response from daemon: pull access denied for adslkjadslakdsj, repository does not exist or may require 'docker login': denied: requested access to the resource is den>

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a3af1f47da)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-06-09 17:02:33 +02:00
Brian Goff dd360c7c0d
Merge pull request #2558 from tiborvass/19.03-expenv-panic
[19.03] Fix bug with panic when DOCKER_CLI_EXPERIMENTAL environment variable is incorrect
2020-05-28 13:41:25 -07:00
Tonis Tiigi 2ee7981985 ssh: avoid setting flags through hostname
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit d30970e3b1)
Signed-off-by: Tibor Vass <tibor@docker.com>
2020-05-28 20:18:03 +00:00
Daniil Nikolenko e90b6bcb62 Fix bug with panic when DOCKER_CLI_EXPERIMENTAL environment variable is incorrect
Signed-off-by: Daniil Nikolenko <qoo2p5@gmail.com>
(cherry picked from commit cb010db830)
Signed-off-by: Tibor Vass <tibor@docker.com>
2020-05-28 19:21:44 +00:00
Silvin Lubecki 2d1476c6f0 Partially revert cf663b526a as it breaks the version negotiation with an older docker engine.
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 54f766d240)
2020-05-20 18:57:39 +02:00
Silvin Lubecki 1705e47cdf
Merge pull request #2508 from thaJeztah/19.03_backport_config_dont_init
[19.03 backport] config: don't call homedir on init()
2020-05-11 16:27:11 +02:00
Sebastiaan van Stijn 9a57ea8869
Update some uses of errors.Cause() to errors.Is()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit bb7ef2cb3a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-11 14:39:24 +02:00
Sebastiaan van Stijn 8434242c74
config: don't call homedir on init()
This patch changes the package to lazily obtain the user's home-
directory on first use, instead of when initializing the package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8a30653ed5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-09 12:47:39 +02:00
Silvin Lubecki 3929933368
Merge pull request #2457 from thaJeztah/19.03_backport_lazy_feature_detection
[19.03 backport] cli: perform feature detection lazily
2020-04-30 17:43:14 +02:00
Sebastiaan van Stijn cf663b526a
cli: perform feature detection lazily
- Perform feature detection when actually needed, instead of during
  initializing
- Version negotiation is performed either when making an API request,
  or when (e.g.) running `docker help` (to hide unsupported features)
- Use a 2 second timeout when 'pinging' the daemon; this should be
  sufficient for most cases, and when feature detection failed, the
  daemon will still perform validation (and produce an error if needed)
- context.WithTimeout doesn't currently work with ssh connections (connhelper),
  so we're only applying this timeout for tcp:// connections, otherwise
  keep the old behavior.

Before this change:

    time sh -c 'DOCKER_HOST=tcp://42.42.42.41:4242 docker help &> /dev/null'
    real   0m32.919s
    user   0m0.370s
    sys    0m0.227s

    time sh -c 'DOCKER_HOST=tcp://42.42.42.41:4242 docker context ls &> /dev/null'
    real   0m32.072s
    user   0m0.029s
    sys    0m0.023s

After this change:

    time sh -c 'DOCKER_HOST=tcp://42.42.42.41:4242 docker help &> /dev/null'
    real   0m 2.28s
    user   0m 0.03s
    sys    0m 0.03s

    time sh -c 'DOCKER_HOST=tcp://42.42.42.41:4242 docker context ls &> /dev/null'
    real   0m 0.13s
    user   0m 0.02s
    sys    0m 0.02s

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b39739123b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-29 17:12:23 +02:00
Sebastiaan van Stijn c44c18e088
docker build: check experimental --platform on pre-run
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a88a1bea23)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-29 17:12:21 +02:00
Anca Iordache 25f04876d1
app-214 Load Client info in getter function
Signed-off-by: Anca Iordache <anca.iordache@docker.com>

Possible approach for client info

- split ClientInfo() into ClientInfo() and loadClientInfo()
- split ConfigFile() into ConfigFile() and loadConfigFile()
- ConfigFile() and ClientInfo() call their corresponding loadXX function
  if it has not yet been loaded; this allows them to be used before
  Initialize() was called.
- Initialize() *always* (re-)loads the configuration; this makes sure
  that the correct configuration is used when actually calling commands.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 22a5dad847)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-29 17:12:18 +02:00
Sebastiaan van Stijn 4ad65fc358
fix panic on single-character volumes
Before this change, this would cause a panic:

    docker run -it --rm -v 1:/1 alpine
    panic: runtime error: index out of range

    goroutine 1 [running]:
    github.com/docker/cli/cli/compose/loader.isFilePath(0xc42027e058, 0x1, 0x557dcb978c20)
    ...

After this change, a correct error is returned:

    docker run -it --rm -v 1:/1 alpine
    docker: Error response from daemon: create 1: volume name is too short, names should be at least two alphanumeric characters.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 11869fa42a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-28 11:58:25 +02:00
Silvin Lubecki d25e657341
Merge pull request #2445 from thaJeztah/19.03_backport_network_prune_improve_message
[19.03 backport] improve "network prune" output to mention custom networks only
2020-04-21 17:23:18 +02:00
Sebastiaan van Stijn 4fe6b837b7
bump gotest.tools v3.0.1 for compatibility with Go 1.14
full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 2c0e93063b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-21 16:43:18 +02:00
Sebastiaan van Stijn c38b260077
improve "network prune" output to mention custom networks only
The `docker network prune` command removes unused custom networks,
but built-in networks won't be removed. This patch updates the
message to mention that it's only removing custom networks.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit eb93a865ed)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-15 10:54:57 +02:00
Sebastiaan van Stijn fd9eedce3c
Add "host-gateway" to tests for extra_hosts / --add-host
67ebcd6dcf added an exception for
the "host-gateway" magic value to the validation rules, but didn't
add thise value to any of the tests.

This patch adds the magic value to tests, to verify the validation
is skipped for this magic value.

Note that validation on the client side is "optional" and mostly
done to provide a more user-friendly error message for regular
values (IP-addresses).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f88ae74135)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-15 09:53:37 +02:00
Sebastiaan van Stijn f9a5c1f152
Fix builder prune -a/--all flag description
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit aad9d2c958)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-18 14:33:42 +01:00
Samuel Cochran 829843333b
unused-for is a deprecated synonym
See 9e7d5ac5ea/builder/builder-next/builder.go (L574)

Signed-off-by: Samuel Cochran <sj26@sj26.com>
(cherry picked from commit 758d12e651)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-18 14:33:28 +01:00
Silvin Lubecki 9b02509a69
Merge pull request #2291 from thaJeztah/19.03_backport_update_flag_description
[19.03 backport] Update flag description for docker rm -v
2020-01-28 16:10:01 +01:00
Sebastiaan van Stijn 25d53feb65
Annotate flags that are not supported by Buildkit
Before this patch:

```

Usage:	docker build [OPTIONS] PATH | URL | -

Build an image from a Dockerfile

Options:
      --add-host list           Add a custom host-to-IP mapping (host:ip)
      --build-arg list          Set build-time variables
      --cache-from strings      Images to consider as cache sources
      --cgroup-parent string    Optional parent cgroup for the container
      --cpu-period int          Limit the CPU CFS (Completely Fair Scheduler) period
      --cpu-quota int           Limit the CPU CFS (Completely Fair Scheduler) quota
  -c, --cpu-shares int          CPU shares (relative weight)
      --cpuset-cpus string      CPUs in which to allow execution (0-3, 0,1)
      --cpuset-mems string      MEMs in which to allow execution (0-3, 0,1)
      --disable-content-trust   Skip image verification (default true)
  -f, --file string             Name of the Dockerfile (Default is 'PATH/Dockerfile')
      --force-rm                Always remove intermediate containers
      --iidfile string          Write the image ID to the file
      --isolation string        Container isolation technology
      --label list              Set metadata for an image
  -m, --memory bytes            Memory limit
      --memory-swap bytes       Swap limit equal to memory plus swap: '-1' to enable unlimited swap
      --network string          Set the networking mode for the RUN instructions during build (default "default")
      --no-cache                Do not use cache when building the image
  -o, --output stringArray      Output destination (format: type=local,dest=path)
      --platform string         Set platform if server is multi-platform capable
      --progress string         Set type of progress output (auto, plain, tty). Use plain to show container output (default "auto")
      --pull                    Always attempt to pull a newer version of the image
  -q, --quiet                   Suppress the build output and print image ID on success
      --rm                      Remove intermediate containers after a successful build (default true)
      --secret stringArray      Secret file to expose to the build (only if BuildKit enabled): id=mysecret,src=/local/secret
      --security-opt strings    Security options
      --shm-size bytes          Size of /dev/shm
      --squash                  Squash newly built layers into a single new layer
      --ssh stringArray         SSH agent socket or keys to expose to the build (only if BuildKit enabled) (format: default|<id>[=<socket>|<key>[,<key>]])
  -t, --tag list                Name and optionally a tag in the 'name:tag' format
      --target string           Set the target build stage to build.
      --ulimit ulimit           Ulimit options (default [])
```

With this patch applied:

```
DOCKER_BUILDKIT=1 docker build --help

Usage:	docker build [OPTIONS] PATH | URL | -

Build an image from a Dockerfile

Options:
      --add-host list           Add a custom host-to-IP mapping (host:ip)
      --build-arg list          Set build-time variables
      --cache-from strings      Images to consider as cache sources
      --disable-content-trust   Skip image verification (default true)
  -f, --file string             Name of the Dockerfile (Default is 'PATH/Dockerfile')
      --iidfile string          Write the image ID to the file
      --isolation string        Container isolation technology
      --label list              Set metadata for an image
      --network string          Set the networking mode for the RUN instructions during build (default "default")
      --no-cache                Do not use cache when building the image
  -o, --output stringArray      Output destination (format: type=local,dest=path)
      --platform string         Set platform if server is multi-platform capable
      --progress string         Set type of progress output (auto, plain, tty). Use plain to show container output (default "auto")
      --pull                    Always attempt to pull a newer version of the image
  -q, --quiet                   Suppress the build output and print image ID on success
      --secret stringArray      Secret file to expose to the build (only if BuildKit enabled): id=mysecret,src=/local/secret
      --squash                  Squash newly built layers into a single new layer
      --ssh stringArray         SSH agent socket or keys to expose to the build (only if BuildKit enabled) (format: default|<id>[=<socket>|<key>[,<key>]])
  -t, --tag list                Name and optionally a tag in the 'name:tag' format
      --target string           Set the target build stage to build.
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 7eecbb96af)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-27 15:57:30 +01:00
Sebastiaan van Stijn 1d540a50d0
Update flag description for docker rm -v
The `-v` option removes anonymous volume only, and keeps
named volumes.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8f5379b301)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-27 15:53:37 +01:00
Silvin Lubecki a3e131b323
Merge pull request #2264 from thaJeztah/19.03_backport_passthrough_user_pass
[19.03 backport] Allow username/password in config file
2020-01-17 14:53:33 +01:00
Silvin Lubecki 7a9a020688
Merge pull request #2265 from thaJeztah/19.03_backport_fix_pull_test
[19.03 backport] fix(pull_test): for quiet option
2020-01-17 14:49:03 +01:00
Sam 5761759e43
fix formatting issue of encoded url
Signed-off-by: Sam <samashah@microsoft.com>
(cherry picked from commit ee76ac8f93)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:48:54 +01:00
knqyf263 8291738733
fix(pull_test): for quiet option
Signed-off-by: Teppei Fukuda <knqyf263@gmail.com>
(cherry picked from commit 7634872a39)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:40:54 +01:00
Jon Johnson a42f8129fd
Fix lint issue
Signed-off-by: Jon Johnson <jonjohnson@google.com>
(cherry picked from commit 8f11fbc876)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:37:04 +01:00
Jon Johnson 41b01f1319
Add test case to cover non-empty auth entry
Signed-off-by: Jon Johnson <jonjohnson@google.com>
(cherry picked from commit 415f608620)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:36:56 +01:00
Jon Johnson a1c4a0f9e8
Allow username/password in config file
Signed-off-by: Jon Johnson <jonjohnson@google.com>
(cherry picked from commit 37e9cabf11)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:36:48 +01:00
Silvin Lubecki ab4a5cc0f7
Merge pull request #2195 from tiborvass/19.03-fix-cp
[19.03 backport] cp: allow trailing slash in non-existant destination
2020-01-16 22:39:34 +01:00
Sebastiaan van Stijn a7cad2fec2
Merge pull request #2184 from thaJeztah/19.03_backport_fix_max_replicas_per_node_interpolation
[19.03 backport] Add interpolation type cast for max_replicas_per_node
2020-01-16 21:17:38 +01:00
Nick Adcock 813cc7ed9c
Reverse order of long-form ports
Reverses the order long-form port options when converted to short-form
to correctly match the documentation and `docker service create`.

Post change `-p published=8111,target=8112` is the equivalent of
`8111:8112`

Signed-off-by: Nick Adcock <nick.adcock@docker.com>
(cherry picked from commit 154a1f6df8)
Signed-off-by: Nick Adcock <nick.adcock@docker.com>
2020-01-16 12:29:56 +00:00
Sebastiaan van Stijn e70edc3576
cli/command/stack/kubernetes: Using the variable on range scope `c` in function literal (scopelint)
```
cli/command/stack/kubernetes/convert_test.go:199:35: Using the variable on range scope `c` in function literal (scopelint)
			conv, err := NewStackConverter(c.version)
			                               ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 640305f33c)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:17:04 +01:00
Sebastiaan van Stijn b320feff9b
cli/command/container: Using the variable on range scope `c` in function literal (scopelint)
```
cli/command/container/create_test.go:120:20: Using the variable on range scope `c` in function literal (scopelint)
				defer func() { c.ResponseCounter++ }()
				               ^
cli/command/container/create_test.go:121:12: Using the variable on range scope `c` in function literal (scopelint)
				switch c.ResponseCounter {
				       ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 542f80241e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:17:03 +01:00
Sebastiaan van Stijn 73dad4356e
cli/command/stack/kubernetes: Using a reference for the variable on range scope `obj` (scopelint)
```
cli/command/stack/kubernetes/watcher_test.go:44:20: Using a reference for the variable on range scope `obj` (scopelint)
		if err := o.Add(&obj); err != nil {
		                 ^
cli/command/stack/kubernetes/watcher_test.go:49:20: Using a reference for the variable on range scope `obj` (scopelint)
		if err := o.Add(&obj); err != nil {
		                 ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 754fc6fe67)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:17:02 +01:00
Sebastiaan van Stijn 1b35214c11
cli/manifest: Using the variable on range scope `testcase` in function literal (scopelint)
```
cli/manifest/store/store_test.go:97:29: Using the variable on range scope `testcase` in function literal (scopelint)
			actual, err := store.Get(testcase.listRef, testcase.manifestRef)
			                         ^
cli/manifest/store/store_test.go:98:7: Using the variable on range scope `testcase` in function literal (scopelint)
			if testcase.expectedErr != "" {
			   ^
cli/manifest/store/store_test.go:99:26: Using the variable on range scope `testcase` in function literal (scopelint)
				assert.Error(t, err, testcase.expectedErr)
				                     ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit cd3dca37b8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:17:01 +01:00
Sebastiaan van Stijn fccc105d4d
cli/compose/template: Using the variable on range scope `tc` in function literal (scopelint)
```
cli/compose/template/template_test.go:279:31: Using the variable on range scope `tc` in function literal (scopelint)
			actual := ExtractVariables(tc.dict, defaultPattern)
			                           ^
cli/compose/template/template_test.go:280:41: Using the variable on range scope `tc` in function literal (scopelint)
			assert.Check(t, is.DeepEqual(actual, tc.expected))
			                                     ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit aafe3df8b3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:17:00 +01:00
Sebastiaan van Stijn 37ef1f56f7
cli/command/container: suppress dogsled warnings
```
cli/command/container/opts_test.go:68:2: declaration has 3 blank identifiers (dogsled)
	_, _, _, err := parseRun(strings.Split(args+" ubuntu bash", " "))
	^
cli/command/container/opts_test.go:542:2: declaration has 3 blank identifiers (dogsled)
	_, _, _, err = parseRun([]string{"--uts=container:", "img", "cmd"})
	^
cli/command/container/opts_test.go:603:2: declaration has 3 blank identifiers (dogsled)
	_, _, _, err := parseRun([]string{"--rm", "--restart=always", "img", "cmd"})
	^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 79dc83e78b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:17:00 +01:00
Sebastiaan van Stijn be5a3ccb7d
cli/command: Using the variable on range scope `testcase` in function literal (scopelint)
```
cli/command/cli_test.go:157:15: Using the variable on range scope `testcase` in function literal (scopelint)
				pingFunc: testcase.pingFunc,
				          ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 2ec424a2d9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:58 +01:00
Sebastiaan van Stijn b083f625e4
cli: remove unnecessary newlines (whitespace)
```
cli/config/config_test.go:465: unnecessary trailing newline (whitespace)

}
cli/compose/interpolation/interpolation.go:56: unnecessary leading newline (whitespace)
	switch value := value.(type) {

cli/compose/interpolation/interpolation.go:94: unnecessary trailing newline (whitespace)

	}
cli/command/image/build/context.go:348: unnecessary trailing newline (whitespace)

		}
internal/licenseutils/client_test.go:98: unnecessary leading newline (whitespace)
func (c *fakeLicensingClient) LoadLocalLicense(ctx context.Context, dclnt licensing.WrappedDockerClient) (*model.Subscription, error) {

cli/registry/client/fetcher.go:211: unnecessary leading newline (whitespace)
	for _, endpoint := range endpoints {
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 612d83d6df)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:57 +01:00
Sebastiaan van Stijn f7b23cf572
cli/command/trust: Using the variable on range scope `keyBytes` in function literal (scopelint)
```
cli/command/trust/key_load_test.go:121:27: Using the variable on range scope `keyID` in function literal (scopelint)
			testLoadKeyFromPath(t, keyID, keyBytes)
			                       ^
cli/command/trust/key_load_test.go:176:32: Using the variable on range scope `keyBytes` in function literal (scopelint)
			testLoadKeyTooPermissive(t, keyBytes)
			                            ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 7c4b63b1c3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:56 +01:00
Sebastiaan van Stijn bda413e0ae
cli/command/context: Using the variable on range scope `c` in function literal (scopelint)
```
cli/command/context/create_test.go:270:31: Using the variable on range scope `c` in function literal (scopelint)
				Name:                     c.name,
				                          ^
cli/command/context/create_test.go:271:31: Using the variable on range scope `c` in function literal (scopelint)
				Description:              c.description,
				                          ^
cli/command/context/create_test.go:272:31: Using the variable on range scope `c` in function literal (scopelint)
				DefaultStackOrchestrator: c.orchestrator,

cli/command/context/create_test.go:346:31: Using the variable on range scope `c` in function literal (scopelint)
				Name:                     c.name,
				                          ^
cli/command/context/create_test.go:347:31: Using the variable on range scope `c` in function literal (scopelint)
				Description:              c.description,
				                          ^
cli/command/context/create_test.go:348:31: Using the variable on range scope `c` in function literal (scopelint)
				DefaultStackOrchestrator: c.orchestrator,
				                          ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a269e17d72)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:55 +01:00
Sebastiaan van Stijn 42ad2446e0
cli/compose/loader: Using a reference for the variable on range scope `overrideService` (scopelint)
```
cli/compose/loader/merge.go:64:41: Using a reference for the variable on range scope `overrideService` (scopelint)
			if err := mergo.Merge(&baseService, &overrideService, mergo.WithAppendSlice, mergo.WithOverride, mergo.WithTransformers(specials)); err != nil {
			                                     ^
cli/compose/loader/loader_test.go:1587:28: Using the variable on range scope `testcase` in function literal (scopelint)
			config, err := loadYAML(testcase.yaml)
			                        ^
cli/compose/loader/loader_test.go:1590:58: Using the variable on range scope `testcase` in function literal (scopelint)
			assert.Check(t, is.DeepEqual(config.Services[0].Init, testcase.init))
			                                                      ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 96ec7299d8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:53 +01:00
Sebastiaan van Stijn 43b498829b
cli/config: Using the variable on range scope `tc` in function literal (scopelint)
```
cli/config/config_test.go:590:11: Using the variable on range scope `tc` in function literal (scopelint)
			SetDir(tc.dir)
			       ^
cli/config/config_test.go:591:19: Using the variable on range scope `tc` in function literal (scopelint)
			f, err := Path(tc.path...)
			               ^
cli/config/config_test.go:592:23: Using the variable on range scope `tc` in function literal (scopelint)
			assert.Equal(t, f, tc.expected)
			                   ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 5a2a9d9ca8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:51 +01:00
Sebastiaan van Stijn bd778fc27b
cli/command/formatter: Error return value of `ContainerWrite` is not checked (errcheck)
```
cli/command/formatter/container_test.go:315:17: Error return value of `ContainerWrite` is not checked (errcheck)
		ContainerWrite(context.context, containers)
		              ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e74e2c7741)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:51 +01:00
Sebastiaan van Stijn 10fda078a0
cli/command: Error return value of `cli.Apply` is not checked (errcheck)
```
cli/command/cli_test.go:297:11: Error return value of `cli.Apply` is not checked (errcheck)
	cli.Apply(
	         ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 008f6a2da3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:50 +01:00
Sebastiaan van Stijn 49253c7b00
cli/command/formatter: Error return value of `ImageWrite` is not checked (errcheck)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9275e2cb66)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:50 +01:00
Sebastiaan van Stijn 98150ae8ac
cli/context/store: SA5001: should check returned error before deferring f.Close() (staticcheck)
```
cli/context/store/store_test.go:156:2: SA5001: should check returned error before deferring f.Close() (staticcheck)
	defer f.Close()
	^
cli/context/store/store_test.go:189:2: SA5001: should check returned error before deferring f.Close() (staticcheck)
	defer f.Close()
	^
cli/context/store/store_test.go:240:2: SA5001: should check returned error before deferring f.Close() (staticcheck)
	defer f.Close()
	^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit fe3cc6eb7b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:49 +01:00