Skip to content

lint: update golangci-lint to v1.45.2 - #3502

Merged
thaJeztah merged 4 commits into
docker:masterfrom
thaJeztah:bump_golangci_lint
Mar 28, 2022
Merged

lint: update golangci-lint to v1.45.2#3502
thaJeztah merged 4 commits into
docker:masterfrom
thaJeztah:bump_golangci_lint

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

@codecov-commenter

codecov-commenter commented Mar 27, 2022

Copy link
Copy Markdown

Codecov Report

Merging #3502 (7204b7a) into master (8c58da1) will increase coverage by 0.38%.
The diff coverage is 75.00%.

@@            Coverage Diff             @@
##           master    #3502      +/-   ##
==========================================
+ Coverage   58.63%   59.01%   +0.38%     
==========================================
  Files         282      284       +2     
  Lines       23826    23834       +8     
==========================================
+ Hits        13970    14066      +96     
+ Misses       8998     8909      -89     
- Partials      858      859       +1     

@thaJeztah
thaJeztah force-pushed the bump_golangci_lint branch 6 times, most recently from d2986e6 to 92f1c97 Compare March 27, 2022 19:50
tmpl, err := templates.Parse(c.finalFormat)
if err != nil {
return tmpl, errors.Errorf("Template parsing error: %v\n", err)
return tmpl, errors.Wrap(err, "template parsing error")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW; although the error changed (removing the newline at the end); when printed on the command-line, there's still a newline printed, so not sure why this was added in the first place 🤷‍♂️

@thaJeztah
thaJeztah force-pushed the bump_golangci_lint branch 2 times, most recently from 1790ec3 to 7204b7a Compare March 27, 2022 20:05
@thaJeztah thaJeztah mentioned this pull request Mar 27, 2022
1 task
@thaJeztah
thaJeztah marked this pull request as ready for review March 27, 2022 20:18
@thaJeztah

Copy link
Copy Markdown
Member Author

whoop, green now; @silvin-lubecki @crazy-max PTAL

if c.os == winOSType {
return units.BytesSize(c.s.Memory)
}
return fmt.Sprintf("%s / %s", units.BytesSize(c.s.Memory), units.BytesSize(c.s.MemoryLimit))

@silvin-lubecki silvin-lubecki Mar 28, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I'm not really enthousiast with this modification, even if I understand why. I think the sprintf version is easier to read and review. Anyway it's just nitpicking here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me do those separate, as they're not strictly needed for the linter, but given that this stats output is called in a loop (to refresh stats), I thought it would be worth to change them. Looking at the file, I now see some other ones that could be adjusted in that respect, so let me change these back and do it separately.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh! of course it helps if I ping you after that; updated 👍 PTAL

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still LGTM 🤗

    cli/command/container/formatter_stats.go:184:10: S1039: unnecessary use of fmt.Sprintf (gosimple)
            return fmt.Sprintf("--")
                   ^
    cli/command/container/formatter_stats.go:191:10: S1039: unnecessary use of fmt.Sprintf (gosimple)
            return fmt.Sprintf("-- / --")
                   ^
    cli/command/container/formatter_stats.go:201:10: S1039: unnecessary use of fmt.Sprintf (gosimple)
            return fmt.Sprintf("--")
                   ^
    cli/command/container/formatter_stats.go:184:10: S1039: unnecessary use of fmt.Sprintf (gosimple)
            return fmt.Sprintf("--")
                   ^
    cli/command/container/formatter_stats.go:191:10: S1039: unnecessary use of fmt.Sprintf (gosimple)
            return fmt.Sprintf("-- / --")
                   ^
    cli/command/container/formatter_stats.go:201:10: S1039: unnecessary use of fmt.Sprintf (gosimple)
            return fmt.Sprintf("--")
                   ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    cli/config/credentials/native_store.go:10:2: G101: Potential hardcoded credentials (gosec)
        remoteCredentialsPrefix = "docker-credential-"
        ^
    cli/command/service/opts.go:917:2: G101: Potential hardcoded credentials (gosec)
        flagCredentialSpec          = "credential-spec"
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    cli/compose/interpolation/interpolation.go:102:4: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
                "invalid interpolation format for %s: %#v. You may need to escape any $ with another $.",
                ^

    cli/command/stack/loader/loader.go:30:30: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
                return nil, errors.Errorf("Compose file contains unsupported options:\n\n%s\n",
                                          ^

    cli/command/formatter/formatter.go:76:30: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
            return tmpl, errors.Errorf("Template parsing error: %v\n", err)
                                       ^

    cli/command/formatter/formatter.go:97:24: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
            return errors.Errorf("Template parsing error: %v\n", err)
                                 ^

    cli/command/image/build.go:257:25: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
                return errors.Errorf("error checking context: '%s'.", err)
                                     ^

    cli/command/volume/create.go:35:27: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
                        return errors.Errorf("Conflicting options: either specify --name or provide positional arg, not both\n")
                                             ^

    cli/command/container/create.go:160:24: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
            return errors.Errorf("failed to remove the CID file '%s': %s \n", cid.path, err)
                                 ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Also removed deprecated linters:

The linter 'interfacer' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner.
The linter 'golint' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner.  Replaced by revive.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
thaJeztah force-pushed the bump_golangci_lint branch from 7204b7a to 3ffe6a3 Compare March 28, 2022 08:37
@thaJeztah
thaJeztah merged commit 9fe6cb4 into docker:master Mar 28, 2022
@thaJeztah
thaJeztah deleted the bump_golangci_lint branch March 28, 2022 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants