Description
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