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

Fix e2e/ctl_v3_auth_test.go:123:5: declaration of err shadows declara… #18781

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

ahrtr
Copy link
Member

@ahrtr ahrtr commented Oct 24, 2024

…tion at line 106

The error was detected in #18779

https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/etcd-io_etcd/18779/pull-etcd-verify/1849478681680941056

It's weird why the main branch didn't see this failure. @ivanvc

stderr: e2e/ctl_v3_auth_test.go:123:5: declaration of "err" shadows declaration at line 106

Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.

@codecov-commenter
Copy link

⚠️ 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 ✅

Project coverage is 68.75%. Comparing base (2f36df8) to head (2c6a275).

Current head 2c6a275 differs from pull request most recent head 6ef1c8c

Please upload reports for the commit 6ef1c8c to get more accurate results.

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

Additional details and impacted files

see 23 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #18781      +/-   ##
==========================================
- Coverage   68.82%   68.75%   -0.08%     
==========================================
  Files         420      420              
  Lines       35511    35511              
==========================================
- Hits        24440    24414      -26     
- Misses       9641     9668      +27     
+ Partials     1430     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 2f36df8...6ef1c8c. Read the comment docs.

@ahrtr
Copy link
Member Author

ahrtr commented Oct 24, 2024

/test pull-etcd-integration-1-cpu-amd64

@ahrtr
Copy link
Member Author

ahrtr commented Oct 24, 2024

/retest

@ivanvc
Copy link
Member

ivanvc commented Oct 24, 2024

It's weird why the main branch didn't see this failure. @ivanvc

Interesting... And I'm not sure why govet complains because the defined err variable is scoped to the if closure 🤔

@ahrtr
Copy link
Member Author

ahrtr commented Oct 24, 2024

I can reproduce this locally,

$ cd tools/mod/
$ go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
$ cd ../../tests/e2e
$ go vet -all -vettool=/Users/wachao/go/bin/shadow
# go.etcd.io/etcd/tests/v3/e2e
# [go.etcd.io/etcd/tests/v3/e2e]
./ctl_v3_auth_test.go:123:5: declaration of "err" shadows declaration at line 106

@ivanvc
Copy link
Member

ivanvc commented Oct 24, 2024

I can reproduce this locally,

$ cd tools/mod/
$ go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
$ cd ../../tests/e2e
$ go vet -all -vettool=/Users/wachao/go/bin/shadow
# go.etcd.io/etcd/tests/v3/e2e
# [go.etcd.io/etcd/tests/v3/e2e]
./ctl_v3_auth_test.go:123:5: declaration of "err" shadows declaration at line 106

With these steps, I can reproduce it in your PR and the main branch. With make verify-govet I couldn't repro locally. Again, I don't understand why it complains, but the fix doesn't harm. Or why the CI didn't complain about the commit to the main branch.

Copy link
Member

@ivanvc ivanvc left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks, @ahrtr

Copy link
Member

@jmhbnz jmhbnz left a comment

Choose a reason for hiding this comment

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

LGTM - Thanks @ahrtr

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahrtr, ivanvc, jmhbnz, serathius

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:
  • OWNERS [ahrtr,jmhbnz,serathius]

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

@ahrtr
Copy link
Member Author

ahrtr commented Oct 25, 2024

With make verify-govet I couldn't repro locally.

It's make verify-govet-shadow. I can still reproduce it with this verification. It seems that it isn't executed at all on main branch when we merge PR.

$ make verify-govet-shadow
......
stderr: # go.etcd.io/etcd/tests/v3/e2e
stderr: # [go.etcd.io/etcd/tests/v3/e2e]
stderr: e2e/ctl_v3_auth_test.go:123:5: declaration of "err" shadows declaration at line 106
FAIL: (code:1):
  % (cd tests && go vet -all -vettool=/Users/wachao/go/bin/shadow go.etcd.io/etcd/tests/v3/common go.etcd.io/etcd/tests/v3/e2e go.etcd.io/etcd/tests/v3/framework go.etcd.io/etcd/tests/v3/framework/config go.etcd.io/etcd/tests/v3/framework/e2e go.etcd.io/etcd/tests/v3/framework/integration go.etcd.io/etcd/tests/v3/framework/interfaces go.etcd.io/etcd/tests/v3/framework/testutils go.etcd.io/etcd/tests/v3/framework/unit go.etcd.io/etcd/tests/v3/integration go.etcd.io/etcd/tests/v3/integration/clientv3 go.etcd.io/etcd/tests/v3/integration/clientv3/concurrency go.etcd.io/etcd/tests/v3/integration/clientv3/connectivity go.etcd.io/etcd/tests/v3/integration/clientv3/examples go.etcd.io/etcd/tests/v3/integration/clientv3/experimental/recipes go.etcd.io/etcd/tests/v3/integration/clientv3/lease go.etcd.io/etcd/tests/v3/integration/clientv3/naming go.etcd.io/etcd/tests/v3/integration/clientv3/snapshot go.etcd.io/etcd/tests/v3/integration/embed go.etcd.io/etcd/tests/v3/integration/proxy/grpcproxy go.etcd.io/etcd/tests/v3/integration/snapshot go.etcd.io/etcd/tests/v3/integration/v2store go.etcd.io/etcd/tests/v3/robustness go.etcd.io/etcd/tests/v3/robustness/client go.etcd.io/etcd/tests/v3/robustness/failpoint go.etcd.io/etcd/tests/v3/robustness/identity go.etcd.io/etcd/tests/v3/robustness/model go.etcd.io/etcd/tests/v3/robustness/options go.etcd.io/etcd/tests/v3/robustness/random go.etcd.io/etcd/tests/v3/robustness/report go.etcd.io/etcd/tests/v3/robustness/scenarios go.etcd.io/etcd/tests/v3/robustness/traffic go.etcd.io/etcd/tests/v3/robustness/validate)

FAIL: 'govet_shadow_per_package /Users/wachao/go/bin/shadow ./...' checking failed (!=0 return code)
There was a Failure in module tests, aborting...
FAIL: 'govet_shadow' FAILED at Fri 25 Oct 2024 10:17:17 BST

@ahrtr ahrtr merged commit 510b9b1 into etcd-io:main Oct 25, 2024
34 checks passed
@ahrtr ahrtr deleted the err_20241024 branch October 25, 2024 09:20
@ivanvc
Copy link
Member

ivanvc commented Oct 25, 2024

It's make verify-govet-shadow. I can still reproduce it with this verification. It seems that it isn't executed at all on main branch when we merge PR.

Ah, ok. Got it. I'll take another look. Thanks

@ivanvc
Copy link
Member

ivanvc commented Oct 25, 2024

Ah, we didn't catch it on the main branch commit because our only postsubmit prow job is the make build one. @jmhbnz, @ahrtr: what jobs should we add as postsubmits? Before the prow migration, every GitHub workflow ran as they were configured with push and pull request actions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

6 participants