-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli/command: remove dot-imports and unhandled errors, and fix TestSwarmUpdate #4619
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thaJeztah
commented
Oct 23, 2023
. "github.com/docker/cli/cli/command" // Prevents a circular import with "github.com/docker/cli/internal/test" | ||
"github.com/docker/cli/cli/command" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only one that's different; hope it works without.
Looks like the new error-checks found one issue;
Which looks legit, because
|
The `docker swarm update` copmmand does not have a `--quiet` flag, but this test was trying to set it. docker swarm update --help Usage: docker swarm update [OPTIONS] Update the swarm Options: --autolock Change manager autolocking setting (true|false) --cert-expiry duration Validity period for node certificates (ns|us|ms|s|m|h) (default 2160h0m0s) --dispatcher-heartbeat duration Dispatcher heartbeat period (ns|us|ms|s|m|h) (default 5s) --external-ca external-ca Specifications of one or more certificate signing endpoints --max-snapshots uint Number of additional Raft snapshots to retain --snapshot-interval uint Number of log entries between Raft snapshots (default 10000) --task-history-limit int Task history retention limit (default 5) The test didn't catch this issue, because errors when setting the flag were not handled, so also adding error-handling; === Failed === FAIL: cli/command/swarm TestSwarmUpdate (0.00s) update_test.go:177: assertion failed: error is not nil: no such flag -quiet Signed-off-by: Sebastiaan van Stijn <[email protected]>
Please the linters in preparation of updating golangci-lint; - remove dot-imports - add some checks for unhandled errors - replace some fixed-value variables for consts cli/command/image/build/context.go:238:17: G107: Potential HTTP request made with variable url (gosec) if resp, err = http.Get(url); err != nil { ^ cli/command/idresolver/idresolver_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/registry_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/cli/command" // Prevents a circular import with "github.com/docker/cli/internal/test" ^ cli/command/task/print_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/update_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/unlock_key_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/join_token_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/promote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/demote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/node/ps_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/update_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/secret/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/secret/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/network/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/container/list_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/service/list_test.go:12:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/service/client_test.go:6:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/list_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/services_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/ps_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ Signed-off-by: Sebastiaan van Stijn <[email protected]>
thaJeztah
changed the title
cli/command: remove dot-imports and unhandled errors
cli/command: remove dot-imports and unhandled errors, and fix TestSwarmUpdate
Oct 23, 2023
1 task
vvoland
approved these changes
Oct 24, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
swarm: TestSwarmUpdate: remove non-existing "--quiet" flag
The
docker swarm update
copmmand does not have a--quiet
flag, but thistest was trying to set it.
The test didn't catch this issue, because errors when setting the flag were
not handled, so also adding error-handling;
cli/command: remove dot-imports and unhandled errors
Please the linters in preparation of updating golangci-lint;
remove dot-imports
add some checks for unhandled errors
replace some fixed-value variables for consts
cli/command/image/build/context.go:238:17: G107: Potential HTTP request made with variable url (gosec)
if resp, err = http.Get(url); err != nil {
^
cli/command/idresolver/idresolver_test.go:7:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/registry_test.go:7:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/cli/command" // Prevents a circular import with "github.com/docker/cli/internal/test"
^
cli/command/task/print_test.go:11:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/swarm/update_test.go:10:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/swarm/unlock_key_test.go:9:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/swarm/join_token_test.go:9:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/node/list_test.go:9:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/node/promote_test.go:8:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/node/demote_test.go:8:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions
^
cli/command/node/ps_test.go:11:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/node/update_test.go:8:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/node/inspect_test.go:9:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions
^
cli/command/secret/ls_test.go:11:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/secret/inspect_test.go:11:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/volume/inspect_test.go:9:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/volume/list_test.go:9:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/config/inspect_test.go:11:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/config/ls_test.go:11:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/network/list_test.go:9:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders"
^
cli/command/container/list_test.go:10:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/service/list_test.go:12:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders"
^
cli/command/service/client_test.go:6:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/stack/list_test.go:8:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/stack/services_test.go:9:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
cli/command/stack/ps_test.go:10:2: dot-imports: should not use dot imports (revive)
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
^
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)