commit 4a7b04d412 configured golangci-lint
to use go1.23 semantics, which enabled the copyloopvar linter.
go1.22 now creates a copy of variables when assigned in a loop; make sure we
don't have files that may downgrade semantics to go1.21 in case that also means
disabling that feature; https://go.dev/ref/spec#Go_1.22
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 7c80e4f938)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Credits to thaJeztah
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 06260e68f3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Some small adjustments for this branch due to some times being renamed
in master;
63.76 cli/command/system/cmd.go:1: : # github.com/docker/cli/cli/command/system [github.com/docker/cli/cli/command/system.test]
63.76 cli/command/system/client_test.go:22:79: undefined: container.Summary
63.76 cli/command/system/client_test.go:38:103: undefined: container.Summary
63.76 cli/command/system/client_test.go:42:21: undefined: container.Summary
63.76 cli/command/system/completion_test.go:30:86: undefined: container.Summary
63.76 cli/command/system/completion_test.go:31:25: undefined: container.Summary
63.76 cli/command/system/completion_test.go:42:86: undefined: container.Summary (typecheck)
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit e1c5180dba)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Update the buildx cli plugin used in the dev-container
full diff: https://github.com/docker/buildx/compare/0.17.1..0.18.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 4242cda826)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Also updating a linter that was deprecated;
The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9af049c618)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
There's only 3 locations where it's hit, so putting #gosec ignore comments
in those locations.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 020f3a7ad9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit 172f340112)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The command to run inside the container is `/etc`. The semicolon is a
statement terminator, which ends the command `docker run busybox /etc`,
while `echo $?` prints the exit code of that full docker command.
Having this mistake could confuse someone who thinks that `/etc; echo
$?` is all run inside the container, which wouldn't help the reader
understand the exit code of the `docker run` command itself.
Signed-off-by: Noah Silas <noah@hustle.com>
(cherry picked from commit 0c999fe95b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Keep the linters (and my IDE) happy; these errors should be safe to ignore.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 4b7a1e4613)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This message resulted in code-lines that were too long; move it to a
const together with the other hint. While at it, also suppress unhandled
error, and touch-up the code-comment.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 378a3d7d36)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
If restoring the terminal state fails, "echo" no longer works, which means
that anything the user types is no longer shown. The login itself may already
have succeeded, so we should not fail the command, but it's good to inform
the user that this happened, which may give them a clue why things no longer
work as they expect them to work.
With this patch:
docker login -u yourname
Password:
Error: failed to restore terminal state to echo input: something bad happened
Login Succeeded
We should consider printing instructions how to restore this manually (other
than restarting the shell). e.g., 'run stty echo' when in a Linux or macOS shell,
but PowerShell and CMD.exe may need different instructions.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 3d8b49523d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
we don't support empty passwords; when prompting the user for a password,
we already trim the result, but we didn't do the same for a password that's
passed through stdin or through the `-p` / `--password` flag.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a21a5f4243)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- move trimming defaultUsername inside the if-branch, as it's the only
location where the result of the trimmed username is use.
- do the reverse for trimming argUser, because the result of trimming
argUser is used outside of the if-branch (not just for the condition).
putting it inside the condition makes it easy to assume the result is
only used locally.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit eda78e9cdc)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
move the "post" check for username being empty inside the branch
that's handling the username, as it's the only branch where username
is mutated after checking if it's empty.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 581cf36bd4)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
remove isDefaultRegistry and inline it where it's used; the code-comment
already outlines what we're looking for, so the intermediate var didn't
add much currently.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a55cfe5f82)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This function has multiple conditional branches, which makes it harder
to see at a glance whether authConfig may be partially populated. This
patch instead returns a fresh instance for error returns to prevent any
confusion.
It also removes the named output variables, as they're now no longer used,
and the returned types should already be descriptive enough to understand
what's returned.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 3a8485085d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>