kubernetes: go vet lostcancel errors in legacy-cloud-providers files
What happened?
We found go vet issues of lostcancel in #109184. (It seems that go vet checks are not running under /staging dir.)
staging/src/k8s.io/legacy-cloud-providers/vsphere/nodemanager.go:190:5: lostcancel: the cancel function is not used on all paths (possible context leak) (govet)
ctx, cancel := context.WithCancel(context.Background())
^
staging/src/k8s.io/legacy-cloud-providers/vsphere/nodemanager.go:236:3: lostcancel: this return statement may be reached without using the cancel var defined on line 190 (govet)
}()
We should fix them to ensure we don’t introduce context leak as the message said.
What did you expect to happen?
These issues from go vet are fixed.
How can we reproduce it (as minimally and precisely as possible)?
Running go vet under staging/src/k8s.io/legacy-cloud-providers/
Anything else we need to know?
No response
Kubernetes version
latest master
Cloud provider
OS version
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, …) and versions (if applicable)
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 16 (10 by maintainers)
This has existed for 4 years, so it’s not release blocking