• Kubernetes Submit Queue's avatar
    Merge pull request #50562 from atlassian/call-cleanup-properly · ccae631f
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue (batch tested with PRs 51134, 51122, 50562, 50971, 51327)
    
    Call the right cleanup function
    
    **What this PR does / why we need it**:
    `defer cleanup()` will always call the function that was returned by the first call to `r.resyncChan()` but it should call the one returned by the last call.
    
    **Special notes for your reviewer**:
    This will print `c1`, not `c2`. See https://play.golang.org/p/FDjDbUxOvI
    ```go
    func main() {
    	var c func()
    	c = c1
    	defer c()
    	c = c2
    }
    
    func c1 () {
    	fmt.Println("c1")
    }
    
    func c2 () {
    	fmt.Println("c2")
    }
    ```
    
    **Release note**:
    ```release-note
    NONE
    ```
    /kind bug
    /sig api-machinery
    ccae631f
Name
Last commit
Last update
.github Loading commit data...
Godeps Loading commit data...
api Loading commit data...
build Loading commit data...
cluster Loading commit data...
cmd Loading commit data...
docs Loading commit data...
examples Loading commit data...
federation Loading commit data...
hack Loading commit data...
logo Loading commit data...
pkg Loading commit data...
plugin Loading commit data...
staging Loading commit data...
test Loading commit data...
third_party Loading commit data...
translations Loading commit data...
vendor Loading commit data...
.bazelrc Loading commit data...
.generated_files Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.kazelcfg.json Loading commit data...
BUILD.bazel Loading commit data...
CHANGELOG.md Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
Makefile.generated_files Loading commit data...
OWNERS Loading commit data...
OWNERS_ALIASES Loading commit data...
README.md Loading commit data...
SUPPORT.md Loading commit data...
Vagrantfile Loading commit data...
WORKSPACE Loading commit data...
code-of-conduct.md Loading commit data...
labels.yaml Loading commit data...