Merge pull request #38825 from enj/enj/i/store_dead_code/38822

Automatic merge from submit-queue

Remove dead code in `pkg/registry/generic/registry/store.go`

Fixes #38822

Depending on the intent of the original code, the correct fix may instead be:

```go
if name, ok := p.MatchesSingle(); ok {
	key, err := e.KeyFunc(ctx, name)
	if err != nil {
		return nil, err
	}
	w, err := e.Storage.Watch(ctx, key, resourceVersion, p)
	if err != nil {
		return nil, err
	}
	if e.Decorator != nil {
		return newDecoratedWatcher(w, e.Decorator), nil
	}
	return w, nil
	// if we cannot extract a key based on the current context, the optimization is skipped
}
```

Signed-off-by: Monis Khan <mkhan@redhat.com>

cc @deads2k
This commit is contained in:
Kubernetes Submit Queue 2016-12-16 06:31:12 -08:00 committed by GitHub
commit 08342c1f3e

View File

@ -879,9 +879,6 @@ func (e *Store) Watch(ctx api.Context, options *api.ListOptions) (watch.Interfac
func (e *Store) WatchPredicate(ctx api.Context, p storage.SelectionPredicate, resourceVersion string) (watch.Interface, error) {
if name, ok := p.MatchesSingle(); ok {
if key, err := e.KeyFunc(ctx, name); err == nil {
if err != nil {
return nil, err
}
w, err := e.Storage.Watch(ctx, key, resourceVersion, p)
if err != nil {
return nil, err