Commit Graph

1952 Commits

Author SHA1 Message Date
ea1f10b440 Merge pull request #5889 from thaJeztah/internalize_manifest
cli/command: deprecate Cli.ManifestStore, Cli.RegistryClient
2025-03-04 20:31:55 +01:00
7bcbe0837b Merge pull request #5888 from thaJeztah/command_no_go_connections
cli/command: remove direct import of docker/go-connections
2025-03-04 20:30:53 +01:00
0b985e74f1 Merge pull request #5881 from thaJeztah/cleanup_otel
cli/command: un-export ResourceAttributesEnvvar, DockerCliAttributePrefix
2025-03-04 18:14:50 +01:00
95ac11e714 cli/command: remove direct import of docker/go-connections
It was only used to check if the value was nil; pass a boolean instead.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 18:00:58 +01:00
8ad07217dc cli/command: deprecate Cli.RegistryClient
This method was a shallow wrapper around registryclient.NewRegistryClient but
due to its signature resulted in various dependencies becoming a dependency
of the "command" package. Consequence of this was that cli-plugins, which
need the cli/command package, would also get those dependencies. It is no
longer used in our code, which constructs the client in packages that need it,
so we can deprecate this method.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 17:48:43 +01:00
e32d5d56f5 cli/command: deprecate Cli.ManifestStore
This method is a shallow wrapper around manifeststore.NewStore, but
due to its signature resulted in various dependencies becoming a dependency
of the "command" package. Consequence of this was that cli-plugins, which
need the cli/command package, would also get those dependencies. It is no
longer used in our code, which constructs the client in packages that need it,
so we can deprecate this method.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 17:48:43 +01:00
985b58e7e1 cli/command: internalize constructing RegistryClient
The CLI.RegistryClient method is a shallow wrapper around registryclient.NewRegistryClient
but due to its signature resulted in various dependencies becoming a dependency
of the "command" package. Consequence of this was that cli-plugins, which
need the cli/command package, would also get those dependencies.

This patch inlines the code where needed, skipping the wrapper

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 17:48:42 +01:00
3b5dff2783 cli/command: internalize constructing ManifestStore
The CLI.ManifestStore method is a shallow wrapper around manifeststore.NewStore
and has no dependency on the CLI itself. However, due to its signature resulted
in various dependencies becoming a dependency of the "command" package.
Consequence of this was that cli-plugins, which need the cli/command package,
would also get those dependencies.

- This patch inlines the code to produce the store, skipping the wrapper.
- Define a local interface for some tests where a dummy store was used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 17:48:42 +01:00
9bc16bbde0 cli/command: deprecate Cli.NotaryClient
This method is a shallow wrapper around trust.GetNotaryRepository, but
due to its signature resulted in the trust package, and notary dependencies
to become a dependency of the CLI. Consequence of this was that cli-plugins,
which need the cli/command package, would also get notary and its
dependencies as a dependency. It is no longer used in our code, which
constructs the client in packages that need it, so we can deprecate this
method.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 17:40:08 +01:00
2793731977 cli/command: internalize constructing Notary client
The CLI.NotaryClient method is a shallow wrapper around trust.GetNotaryRepository
and only depends on the CLI itself to pass its StdErr/StrOut streams.

- This patch inlines the code to produce the client, skipping the wrapper.
- Define a local interface for some tests where a dummy notary client was used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-04 17:40:06 +01:00
6f46cd2f4b cli/registry/client: deprecate RepoNameForReference
This function was added in 02719bdbb5, and
used newDefaultRepositoryEndpoint to get repository info for the given
image-reference.

newDefaultRepositoryEndpoint uses registry.ParseRepositoryInfo under the
hood, but the only information used from the result was the Name field,
which is set using `reference.TrimNamed(name)`. The possible error returned
was based on the domain-name of the image, and only checked for the domain
to not start, or end with a hyphen ("-").

This patch removes the use of RepoNameForReference, deprecates it, and
inlines the code used by it.

There are no known consumers of this function, so we can consider removing
it in the first possible release after this (which can be a minor release).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 15:48:06 +01:00
9dc175d6ef cli/command: un-export ResourceAttributesEnvvar, DockerCliAttributePrefix
These utility functions were added in 8890a1c929,
and are all related to OTEL. The ResourceAttributesEnvvar const defines
the "OTEL_RESOURCE_ATTRIBUTES" environment-variable to use, which is part
of the [OpenTelemetry specification], so should be considered a well-known
env-var, and not up to us to define a const for. These code-changes were not
yet included in a release, so we don't have to deprecate.

This patch:

- Moves the utility functions to the telemetry files, so that all code related
  to OpenTelemetry is together.
- Un-exports the ResourceAttributesEnvvar to reduce our public API.
- Un-exports the DockerCliAttributePrefix to reduce depdency on cli/command
  in CLI-plugins, but adds a TODO to move telemetry-related code to a common
  (internal) package.
- Deprecates the cli-plugins/manager.ResourceAttributesEnvvar const. This
  const has no known consumers, so we could skip deprecation, but just in
  case some codebase uses this.

[OpenTelemetry specification]: https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#general-sdk-configuration

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 14:21:45 +01:00
076ec3b56e Merge pull request #5878 from thaJeztah/trust_cleans
Assorted cleanups to reduce trust / notary imports
2025-03-03 12:18:47 +01:00
fda7da2303 cli/command: remove dependency on distribution/uuid
This uuid package was introduced in 89db01ef97,
but we want to reduce dependency on the old docker/distribution module.

Replace it with google/uuid, which is a commonly used module for this
and already a dependency.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-03 11:41:17 +01:00
c7072a885d cli/command/image: rename vars that shadowed type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-02 14:16:38 +01:00
7a6270d190 cli/command/image: move AddTargetToAllSignableRoles to cli/trust
This utility was shared between the "image" and "trust" packages, and a
shallow wrapper around features in the cli/trust package. Move it there
instead and rename it to `trust.AddToAllSignableRoles`.

There are no known external consumers of this utility, so skipping a
deprecation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-02 14:16:38 +01:00
e6382db10e cli/command/image: move trust unit-tests to trust package
These tests were not testing functionality that was implemented
in the image package. Move them to the trust package, where
they belong.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-02 14:16:37 +01:00
55bc30a784 cli/command/image: use t.SetEnv in trust tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-02 14:16:37 +01:00
049f84c94d cli/command/image: remove TestAddTargetToAllSignableRolesError
This test was only testing trust.GetSignableRoles to return an error
if it's offline, which was duplicating the [TestGetSignableRolesError]
test in the cli/trust package.

[TestGetSignableRolesError]: fe0a8d2791/cli/trust/trust_test.go (L49-L55)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-02 14:16:37 +01:00
791bdf7b3c cli/command/trust: add testPassRetriever helper
Add a basic helper to provide the equivalent of passphrase.ConstantRetriever
with a fixed passphrase for testing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-02 14:16:32 +01:00
1d8f87a2fb cli/command/trust: remove TestGetSignableRolesForTargetAndRemoveError
This test was only testing trust.GetSignableRoles to return an error
if it's offline, which was duplicating the [TestGetSignableRolesError]
test.

[TestGetSignableRolesError]: fe0a8d2791/cli/trust/trust_test.go (L49-L55)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-02 14:16:04 +01:00
d4217eb205 cli/command/trust: remove TestGetOrGenerateNotaryKeyAndInitRepo
This test was only testing trust.GetSignableRoles to return an error
if it's offline, which was duplicating the [TestGetSignableRolesError]
test.

[TestGetSignableRolesError]: fe0a8d2791/cli/trust/trust_test.go (L49-L55)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-02 14:16:04 +01:00
55a83aff23 cli/command/manifest: remove redundant uses of ParseRepositoryInfo
[ParseRepositoryInfo] parses an image reference and returns information
about the Repository and the registry. As part of this, it validates if
the registry's hostname is considered valid using [ValidateIndexName],
as well as normalizing the image reference to strip tags and digests
using [reference.TrimNamed].

ValidateIndexName only provides very limited value; the only validation
happening is to check for the hostname to not start, or end with a hyphen.

The cli/command/manifest package used ParseRepositoryInfo in various
locations where only the repository name was used (i.e., the result
of `reference.TrimNamed` on the given reference), and in one location
only used it to validate the registry name.

For buildPushRequest, the call was fully redundant, as [RepoNameForReference]
was used on the result, calling [newDefaultRepositoryEndpoint], which
uses ParseRepositoryInfo internally, so we were only repeating that work.

This patch removes uses of ParseRepositoryInfo in those places, and instead
calling [reference.TrimNamed] directly.

[ParseRepositoryInfo]: 41f781fab3/registry/config.go (L375-L381)
[ValidateIndexName]: 41f781fab3/registry/config.go (L288-L299)
[reference.TrimNamed]: 41f781fab3/registry/config.go (L369)
[RepoNameForReference]: fe0a8d2791/cli/registry/client/endpoint.go (L107-L110)
[newDefaultRepositoryEndpoint]: fe0a8d2791/cli/registry/client/endpoint.go (L33-L38)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-01 15:40:29 +01:00
fe0a8d2791 Merge pull request #5842 from jsternberg/otel-resource-attributes-merge
cli-plugins: merge OTEL_RESOURCE_ATTRIBUTES environment variable
2025-02-28 10:45:17 +01:00
b414752ef8 Merge pull request #5851 from thaJeztah/err_handle_explicit
explicitly handle errors when wrapping them
2025-02-26 16:23:35 +01:00
0cff340983 cmd/docker: do not print error status on exec/run
Co-authored-by: Fabio Pugliese Ornellas <fabio.ornellas@gmail.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
2025-02-21 12:55:57 +01:00
eb48cad302 Merge pull request #5848 from thaJeztah/improve_swarm_completion
completion: fix / add completion for service names and node-names
2025-02-20 12:24:31 -07:00
8f55738579 completion: add completion for docker service flags
Not all flags have completions yet, and for those that don't have completion,
we disable completion to prevent it completing with filenames.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-20 18:33:17 +01:00
768d10767f completion: add completion for docker node flags
With this patch:

    docker node update --role
    manager  worker

    docker node update --availability
    active  drain   pause

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-20 18:33:17 +01:00
d5e6e2ec6e completion: add completion for node names
Change completion for nodes to use names by default, and bring back
support for the `DOCKER_COMPLETION_SHOW_NODE_IDS` env-var
f9ced58158/contrib/completion/bash/docker (L38)

With this patch:

    docker node ps <tab>
    docker-desktop            self

    export DOCKER_COMPLETION_SHOW_NODE_IDS=yes
    docker node ps <TAB>
    docker-desktop             qyeriqk20al6hy4y869d08ff5  self

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-20 18:33:09 +01:00
da4b6275ba explicitly handle errors when wrapping them
The errors.Wrap and errors.Wrapf functions gracefully handle nil-errors.
This allows them to be used unconditionally regardless if an error
was produced.

While this can be convenient, it can also be err-prone, as replacing
these with stdlib errors means they unconditionally produce an error.

This patch replaces code uses of errors.Wrap to be gated by a check
for nil-errors to future-proof our code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-20 18:10:36 +01:00
7e71782ba6 cli/command/context: fix error-handling of skip-tls-verify
Before 2b9a4d5f4c, this function
would use "errors.Wrap" which returns nil if the original error
was nil. fmt.Errorf does not do this, so without a nil check,
it would unconditionally return an error;

    docker context create arm64 --docker host=ssh://172.17.101.26,skip-tls-verify=False

    unable to create docker endpoint config: name: %!w(<nil>)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-20 17:49:58 +01:00
762d59359e completion: use service names, and support DOCKER_COMPLETION_SHOW_SERVICE_IDS
Change completion for services to use names by default, and bring back
support for the `DOCKER_COMPLETION_SHOW_SERVICE_IDS` env-var
f9ced58158/contrib/completion/bash/docker (L41-L43)

Before this patch:

    docker service ps
    c9vrp2pwni9gx5ghat20rjpcy  hmthf0tqws9xpmd87ok7diqly

With this patch:

    docker service ps<TAB>
    databaseservice  webservice

    export DOCKER_COMPLETION_SHOW_SERVICE_IDS=yes
    docker service ps<TAB>
    c9vrp2pwni9gx5ghat20rjpcy  databaseservice            hmthf0tqws9xpmd87ok7diqly  webservice

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-20 13:51:38 +01:00
8890a1c929 cli-plugins: remove docker.cli specific otel attributes after usage
Remove the `docker.cli` prefixed attributes from
`OTEL_RESOURCE_ATTRIBUTES` after the telemetry provider has been created
within a plugin. This prevents accidentally sending the attributes to
something downstream for the user.

This also fixes an issue with compose where the self-injected `OTEL_RESOURCE_ATTRIBUTES`
would override an existing attribute in the environment file because the
"user environment" overrode the environment file, but the "user
environment" was created by the `docker` tool rather than by the user's
environment.

When `OTEL_RESOURCE_ATTRIBUTES` is empty after pruning, the environment
variable is unset.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-02-19 10:19:00 -06:00
bfd49b1ec3 Merge pull request #5836 from thaJeztah/nakedret
golangci-lint: fix invalid nakedret config, disallow for any func length
2025-02-18 13:15:28 +01:00
5e32ccefac Merge pull request #5835 from thaJeztah/bump_golangci_lint
Dockerfile: update golangci-lint to v1.64.5, replace deprecated `tenv` linter in favor of `usetesting`
2025-02-18 13:15:06 +01:00
a5020ea165 cli/command/container: don't use naked returns (nakedret)
cli/command/container/cp.go:206:3: naked return in func `resolveLocalPath` with 5 lines of code (nakedret)
            return
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-18 09:36:11 +01:00
aca0bd7757 cli/command/trust: fix "usetesting" linting errors
cli/command/trust/signer_add_test.go:71:18: os.CreateTemp("", ...) could be replaced by os.CreateTemp(t.TempDir(), ...) in TestSignerAddCommandNoTargetsKey (usetesting)
        tmpfile, err := os.CreateTemp("", "pemfile")
                        ^
    cli/command/trust/signer_add_test.go:133:18: os.CreateTemp("", ...) could be replaced by os.CreateTemp(t.TempDir(), ...) in TestIngestPublicKeys (usetesting)
        tmpfile, err := os.CreateTemp("", "pemfile")
                        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 22:59:41 +01:00
2b169c1ab5 golangci-lint: enable revive "line-length-limit" linter
also disable "lll" linter as it did the same.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:58 +01:00
1a4491f8c6 cli/command/stack: fix "unused-receiver" linting
cli/command/stack/swarm/client_test.go:47:7: unused-receiver: method receiver 'cli' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (cli *fakeClient) ServerVersion(context.Context) (types.Version, error) {
          ^
    cli/command/stack/swarm/deploy_composefile_test.go:17:7: unused-receiver: method receiver 'n' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (n notFound) NotFound() {}
          ^
    cli/command/stack/client_test.go:47:7: unused-receiver: method receiver 'cli' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (cli *fakeClient) ServerVersion(context.Context) (types.Version, error) {
          ^
    cli/command/stack/client_test.go:183:7: unused-receiver: method receiver 'cli' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (cli *fakeClient) ServiceInspectWithRaw(_ context.Context, serviceID string, _ types.ServiceInspectOptions) (swarm.Service, []byte, error) {
          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:57 +01:00
994e1b7cad cli/command/service: fix "unused-receiver" linting
cli/command/service/update_test.go:511:7: unused-receiver: method receiver 's' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (s secretAPIClientMock) SecretCreate(context.Context, swarm.SecretSpec) (types.SecretCreateResponse, error) {
          ^
    cli/command/service/update_test.go:515:7: unused-receiver: method receiver 's' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (s secretAPIClientMock) SecretRemove(context.Context, string) error {
          ^
    cli/command/service/update_test.go:519:7: unused-receiver: method receiver 's' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (s secretAPIClientMock) SecretInspectWithRaw(context.Context, string) (swarm.Secret, []byte, error) {
          ^
    cli/command/service/generic_resource_opts.go:46: line-length-limit: line is 206 characters, out of limit 200 (revive)
                return nil, fmt.Errorf("invalid generic-resource request `%s=%s`, Named Generic Resources is not supported for service create or update", res.NamedResourceSpec.Kind, res.NamedResourceSpec.Value)
    cli/command/service/create_test.go:24:7: unused-receiver: method receiver 'f' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (f fakeConfigAPIClientList) ConfigCreate(_ context.Context, _ swarm.ConfigSpec) (types.ConfigCreateResponse, error) {
          ^
    cli/command/service/logs.go:320:7: unused-receiver: method receiver 'lw' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (lw *logWriter) parseContext(details map[string]string) (logContext, error) {
          ^
    cli/command/service/opts.go:45:7: unused-receiver: method receiver 'i' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (i *Uint64Opt) Type() string {
          ^
    cli/command/service/update_test.go:523:7: unused-receiver: method receiver 's' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (s secretAPIClientMock) SecretUpdate(context.Context, string, swarm.Version, swarm.SecretSpec) error {
          ^
    cli/command/service/create_test.go:28:7: unused-receiver: method receiver 'f' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (f fakeConfigAPIClientList) ConfigRemove(_ context.Context, _ string) error {
          ^
    cli/command/service/opts.go:70:7: unused-receiver: method receiver 'f' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (f *floatValue) Type() string {
          ^
    cli/command/service/opts.go:117:7: unused-receiver: method receiver 'o' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (o *placementPrefOpts) Type() string {
          ^
    cli/command/service/create_test.go:32:7: unused-receiver: method receiver 'f' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (f fakeConfigAPIClientList) ConfigInspectWithRaw(_ context.Context, _ string) (swarm.Config, []byte, error) {
          ^
    cli/command/service/create_test.go:36:7: unused-receiver: method receiver 'f' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (f fakeConfigAPIClientList) ConfigUpdate(_ context.Context, _ string, _ swarm.Version, _ swarm.ConfigSpec) error {
          ^
    cli/command/service/opts.go:135:7: unused-receiver: method receiver 's' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (s *ShlexOpt) Type() string {
          ^
    cli/command/service/opts.go:366:7: unused-receiver: method receiver 'c' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (c *credentialSpecOpt) Type() string {
          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:57 +01:00
5ef673bb14 cli/command/system: fix "unused-receiver" linting
cli/command/system/dial_stdio.go:113:7: unused-receiver: method receiver 'x' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (x *nopCloseReader) CloseRead() error {
          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:57 +01:00
e71380eb5b cli/command/container: fix "unused-receiver" linting
cli/command/container/client_test.go:78:7: unused-receiver: method receiver 'f' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (f *fakeClient) ContainerExecStart(context.Context, string, container.ExecStartOptions) error {
          ^
    cli/command/container/create_test.go:383:7: unused-receiver: method receiver 'f' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (f fakeNotFound) NotFound()     {}
          ^
    cli/command/container/create_test.go:384:7: unused-receiver: method receiver 'f' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (f fakeNotFound) Error() string { return "error fake not found" }
          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:56 +01:00
4827fdef91 cli/command/trust: fix "unused-receiver" linting
cli/command/trust/inspect_pretty_test.go:31:7: unused-receiver: method receiver 'c' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (c *fakeClient) Info(context.Context) (system.Info, error) {
          ^
    cli/command/trust/inspect_pretty_test.go:35:7: unused-receiver: method receiver 'c' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (c *fakeClient) ImageInspect(context.Context, string, ...client.ImageInspectOption) (image.InspectResponse, error) {
          ^
    cli/command/trust/inspect_pretty_test.go:39:7: unused-receiver: method receiver 'c' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (c *fakeClient) ImagePush(context.Context, string, image.PushOptions) (io.ReadCloser, error) {
          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:56 +01:00
3e44cc4d00 cli/command/image: fix "unused-receiver", "line-length-limit" linting
cli/command/image/remove_test.go:24:7: unused-receiver: method receiver 'n' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (n notFound) NotFound() {}
          ^
    cli/command/image/formatter_history_test.go:110: line-length-limit: line is 558 characters, out of limit 200 (revive)
        withTabs := `/bin/sh -c apt-key adv --keyserver hkp://pgp.mit.edu:80	--recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62	&& echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list  && apt-get update  && apt-get install --no-install-recommends --no-install-suggests -y       ca-certificates       nginx=${NGINX_VERSION}       nginx-module-xslt       nginx-module-geoip       nginx-module-image-filter       nginx-module-perl       nginx-module-njs       gettext-base  && rm -rf /var/lib/apt/lists/*` //nolint:lll
    cli/command/image/formatter_history_test.go:111: line-length-limit: line is 552 characters, out of limit 200 (revive)
        expected := `/bin/sh -c apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 && echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list  && apt-get update  && apt-get install --no-install-recommends --no-install-suggests -y       ca-certificates       nginx=${NGINX_VERSION}       nginx-module-xslt       nginx-module-geoip       nginx-module-image-filter       nginx-module-perl       nginx-module-njs       gettext-base  && rm -rf /var/lib/apt/lists/*` //nolint:lll

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:56 +01:00
e2f28fac47 cli/command/registry: fix "unused-receiver" linting
cli/command/registry/login_test.go:36:7: unused-receiver: method receiver 'c' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (c *fakeClient) Info(context.Context) (system.Info, error) {
          ^
    cli/command/registry/login_test.go:40:7: unused-receiver: method receiver 'c' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (c *fakeClient) RegistryLogin(_ context.Context, auth registrytypes.AuthConfig) (registrytypes.AuthenticateOKBody, error) {
          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:56 +01:00
a54d356a7b cli/command/swarm: fix "unused-receiver" linting
cli/command/swarm/opts.go:71:7: unused-receiver: method receiver 'a' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (a *NodeAddrOption) Type() string {
          ^
    cli/command/swarm/opts.go:107:7: unused-receiver: method receiver 'm' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (m *ExternalCAOption) Type() string {
          ^
    cli/command/swarm/opts.go:132:7: unused-receiver: method receiver 'p' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (p *PEMFile) Type() string {
          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:56 +01:00
25e6b2da04 cli/command/formatter: fix "unused-receiver" linting
cli/command/formatter/custom.go:35:7: unused-receiver: method receiver 'c' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (c SubHeaderContext) Label(name string) string {
          ^
    cli/command/formatter/container_test.go:334: line-length-limit: line is 204 characters, out of limit 200 (revive)
                context:  Context{Format: NewContainerFormat(`table {{truncate .ID 5}}\t{{json .Image}} {{.RunningFor}}/{{title .Status}}/{{pad .Ports 2 2}}.{{upper .Names}} {{lower .Status}}`, false, true)},
    cli/command/formatter/container_test.go:831: line-length-limit: line is 247 characters, out of limit 200 (revive)
                expected: "80/tcp, 80/udp, 1024/tcp, 1024/udp, 12345/sctp, 1.1.1.1:1024->80/tcp, 1.1.1.1:1024->80/udp, 2.1.1.1:1024->80/tcp, 2.1.1.1:1024->80/udp, 1.1.1.1:80->1024/tcp, 1.1.1.1:80->1024/udp, 2.1.1.1:80->1024/tcp, 2.1.1.1:80->1024/udp",
    cli/command/formatter/disk_usage.go:273:7: unused-receiver: method receiver 'c' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (c *diskUsageImagesContext) Type() string {
          ^
    cli/command/formatter/formatter_test.go:31:7: unused-receiver: method receiver 'f' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (f fakeSubContext) FullHeader() any {
          ^
    cli/command/formatter/reflect_test.go:13:7: unused-receiver: method receiver 'd' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (d *dummy) Func1() string {
          ^
    cli/command/formatter/disk_usage.go:324:7: unused-receiver: method receiver 'c' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (c *diskUsageContainersContext) Type() string {
          ^
    cli/command/formatter/disk_usage.go:332:7: unused-receiver: method receiver 'c' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (c *diskUsageContainersContext) isActive(ctr container.Summary) bool {
          ^
    cli/command/formatter/reflect_test.go:17:7: unused-receiver: method receiver 'd' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (d *dummy) func2() string { //nolint:unused
          ^
    cli/command/formatter/reflect_test.go:21:7: unused-receiver: method receiver 'd' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (d *dummy) Func3() (string, int) {
          ^
    cli/command/formatter/disk_usage.go:385:7: unused-receiver: method receiver 'c' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (c *diskUsageVolumesContext) Type() string {
          ^
    cli/command/formatter/disk_usage.go:446:7: unused-receiver: method receiver 'c' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (c *diskUsageBuilderContext) Type() string {
          ^
    cli/command/formatter/reflect_test.go:25:7: unused-receiver: method receiver 'd' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (d *dummy) Func4() int {
          ^
    cli/command/formatter/reflect_test.go:31:7: unused-receiver: method receiver 'd' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (d *dummy) Func5() dummyType {
          ^
    cli/command/formatter/reflect_test.go:35:7: unused-receiver: method receiver 'd' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (d *dummy) FullHeader() string {
          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:56 +01:00
1b3718f459 cli/command: fix "unused-receiver" linting
cli/command/cli.go💯7: unused-receiver: method receiver 'cli' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (cli *DockerCli) DefaultVersion() string {
          ^
    cli/command/cli.go:234:7: unused-receiver: method receiver 'cli' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (cli *DockerCli) ManifestStore() manifeststore.Store {
          ^
    cli/command/telemetry.go:57:7: unused-receiver: method receiver 'cli' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (cli *DockerCli) TracerProvider() trace.TracerProvider {
          ^
    cli/command/telemetry.go:61:7: unused-receiver: method receiver 'cli' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (cli *DockerCli) MeterProvider() metric.MeterProvider {
          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:55 +01:00
cac88ca34c cli/command: wrap some long lines (revive)
cli/command/cli_options.go:180: line-length-limit: line is 205 characters, out of limit 200 (revive)
      			return errdefs.InvalidParameter(errors.Errorf("failed to parse custom headers from %s environment variable: value must be formatted as comma-separated key=value pairs", envOverrideHTTPHeaders))
      cli/command/cli_options.go:194: line-length-limit: line is 208 characters, out of limit 200 (revive)
      				return errdefs.InvalidParameter(errors.Errorf(`failed to set custom headers from %s environment variable: value contains a key=value pair with an empty key: '%s'`, envOverrideHTTPHeaders, kv))

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:52 +01:00