etcd icon indicating copy to clipboard operation
etcd copied to clipboard

fix: enable gofumpt instead of gofmt linter in client

Open mmorel-35 opened this issue 1 year ago • 9 comments

enables and fixes gofumpt linter issues in client directory

mmorel-35 avatar Oct 17 '24 20:10 mmorel-35

Hi @mmorel-35. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Oct 17 '24 20:10 k8s-ci-robot

/remove-area contrib /remove-area etcdctl /remove-area etcdutl /remove-area performance /remove-area robustness-testing

mmorel-35 avatar Oct 17 '24 20:10 mmorel-35

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 68.75%. Comparing base (3d6ff97) to head (5c74582).

:exclamation: Current head 5c74582 differs from pull request most recent head 906247c

Please upload reports for the commit 906247c to get more accurate results.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
Files with missing lines Coverage Δ
client/v3/client.go 84.89% <ø> (ø)
client/v3/compare.go 75.00% <ø> (ø)
client/v3/concurrency/mutex.go 66.23% <ø> (+5.19%) :arrow_up:
client/v3/kv.go 94.44% <ø> (ø)
client/v3/mirror/syncer.go 76.74% <100.00%> (+0.55%) :arrow_up:
client/v3/retry.go 79.31% <ø> (ø)
client/v3/retry_interceptor.go 65.61% <ø> (ø)
client/v3/watch.go 94.23% <ø> (+0.99%) :arrow_up:

... and 19 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #18748      +/-   ##
==========================================
- Coverage   68.77%   68.75%   -0.02%     
==========================================
  Files         420      420              
  Lines       35501    35502       +1     
==========================================
- Hits        24416    24410       -6     
- Misses       9657     9663       +6     
- Partials     1428     1429       +1     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3d6ff97...906247c. Read the comment docs.

codecov-commenter avatar Oct 17 '24 20:10 codecov-commenter

@ahrtr, @serathius, thoughts on replacing gofmt with gofumpt?

ivanvc avatar Oct 17 '24 21:10 ivanvc

As it is more strict than gofmt I didn't suggest it at first. That's very frequently used.

mmorel-35 avatar Oct 17 '24 21:10 mmorel-35

/ok-to-test

ahrtr avatar Oct 18 '24 12:10 ahrtr

A quick question, are all the changes in this PR detected/suggested by gofumpt?

It seems a little better to apply gofumpt based on the changes in this PR.

ahrtr avatar Oct 18 '24 12:10 ahrtr

Nothing was done manually here, I changed from gofmt to gofumpt, executed make fix-lint and provided a PR with only changes in client directory

mmorel-35 avatar Oct 18 '24 12:10 mmorel-35

@ahrtr,

There is no suggested assignee here. Do you know why ? Who shall be assigned then ?

mmorel-35 avatar Oct 24 '24 13:10 mmorel-35

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahrtr, ivanvc, mmorel-35

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Oct 24 '24 21:10 k8s-ci-robot

Should we add a note in the contributor guide about using gofumpt instead of gofmt?

You can provide this in the documentation but I would recommend to just use make fix-lint before committing to apply golangci configuration.

If you want to use IDE default configuration it is usually better to move the config file to the root of the project.

mmorel-35 avatar Oct 25 '24 07:10 mmorel-35

To be clearer, we enable both gofmt via verify-gofmt and gofumpt via the verify-lint.

Enforce a stricter format than gofmt, while being backwards compatible. That is, gofumpt is happy with a subset of the formats that gofmt is happy with.

ahrtr avatar Oct 25 '24 11:10 ahrtr