Skip to content
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

assorted cleanups: use Println, rename vars for consistency #5783

Merged
merged 21 commits into from
Feb 3, 2025

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Feb 1, 2025

minor cleanups: use Println, rename vars for consistency

  • use Println to print newline instead of custom format
  • use apiClient instead of client for the API client to prevent shadowing imports.
  • use dockerCLI with Go's standard camelCase casing.
  • suppress some errors to make my IDE and linters happier

cli/command/volume: remove example and var for long description

This was the only command for which we set the "example" field; while
we could consider doing this for other commands, we need to look what's
best w.r.t. duplicating the information maintained in markdown.

Also remove the intermediate variable used for the long description,
as this was also the only location where we used one.

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added status/2-code-review kind/refactor PR's that refactor, or clean-up code labels Feb 1, 2025
@thaJeztah thaJeztah added this to the 28.0.0 milestone Feb 1, 2025
@thaJeztah thaJeztah self-assigned this Feb 1, 2025
@codecov-commenter
Copy link

codecov-commenter commented Feb 1, 2025

Codecov Report

Attention: Patch coverage is 51.67785% with 144 lines in your changes missing coverage. Please review.

Project coverage is 59.42%. Comparing base (4d7fe01) to head (987da09).
Report is 64 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5783      +/-   ##
==========================================
- Coverage   59.42%   59.42%   -0.01%     
==========================================
  Files         347      347              
  Lines       29402    29398       -4     
==========================================
- Hits        17472    17469       -3     
+ Misses      10958    10957       -1     
  Partials      972      972              

@thaJeztah
Copy link
Member Author

thaJeztah commented Feb 1, 2025

Derp; missed a newline change somewhere;

=== FAIL: e2e/cli-plugins TestCliInitialized/withhook (0.03s)
    run_test.go:227: assertion failed: 
        --- ←
        +++ →
        @@ -1,2 +1 @@
        -Plugin·PersistentPreRunE·called
        -
        +Plugin·PersistentPreRunE·called
```

We should also look at the cli-docs tool to ignore leading/trailing whitespace in these, so that we can use a more ergonomic way of setting these for multiple lines. I _think_ Cobra itself trims leading/trailing whitespace;

```patch
diff --git a/docs/reference/commandline/cp.md b/docs/reference/commandline/cp.md
index ded96d6..0ca9e7c 100644
--- a/docs/reference/commandline/cp.md
+++ b/docs/reference/commandline/cp.md
@@ -8,6 +8,7 @@ and extract it to a directory destination in a container.
 Use '-' as the destination to stream a tar archive of a
 container source to stdout.
 
+
 ### Aliases
 
 `docker container cp`, `docker cp`
```

@thaJeztah thaJeztah force-pushed the newline_galore branch 2 times, most recently from c48e591 to d104293 Compare February 2, 2025 10:48
@thaJeztah thaJeztah changed the title minor cleanups: use Println, rename vars for consistency assorted cleanups: use Println, rename vars for consistency Feb 2, 2025
@thaJeztah thaJeztah force-pushed the newline_galore branch 2 times, most recently from d030d38 to 69d40c9 Compare February 2, 2025 11:33
@thaJeztah
Copy link
Member Author

Oh! Needs a rebase; conflict in one file; let me do so

- use Println to print newline instead of custom format
- suppress some errors to make my IDE and linters happier
- use res.Assert() with icmd.Expected{} where possible to make
  assertions not depend on newline / whitespace randomness
- use apiClient instead of client for the API client to
  prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- use apiClient instead of client for the API client to
  prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- use apiClient instead of client for the API client to
  prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- use apiClient instead of client for the API client to
  prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- use apiClient instead of client for the API client to
  prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- use apiClient instead of client for the API client to
  prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier
- fix some tests to work with "go test -update"
- rewrite TestSwarmInit to use sub-tests

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- use apiClient instead of client for the API client to
  prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use Println to print newline instead of custom format
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
This was the only command for which we set the "example" field; while
we could consider doing this for other commands, we need to look what's
best w.r.t. duplicating the information maintained in markdown.

Also remove the intermediate variable used for the long description,
as this was also the only location where we used one.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah merged commit 4808d1b into docker:master Feb 3, 2025
89 checks passed
@thaJeztah thaJeztah deleted the newline_galore branch February 3, 2025 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/refactor PR's that refactor, or clean-up code status/2-code-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants