From 4e28a08da3640ca6f07415d1a0020350c7aab2c1 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 8 May 2025 14:29:21 +0200 Subject: [PATCH] client-go: call out WithContext inconsistency This raises awareness so that developers hopefully get it right without having to learn about it from compile errors. It also explains that creating a PR to fix the naming is not desired. Kubernetes-commit: f40892f4813f29fc305d59073d2464a1fd7d6fe5 --- tools/cache/listwatch.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/cache/listwatch.go b/tools/cache/listwatch.go index 30d30e88..f5b04a19 100644 --- a/tools/cache/listwatch.go +++ b/tools/cache/listwatch.go @@ -154,6 +154,10 @@ type WatchFuncWithContext func(ctx context.Context, options metav1.ListOptions) // ListWithContextFunc and WatchFuncWithContext are preferred if // a context is available, otherwise ListFunc and WatchFunc. // +// Beware of the inconsistent naming of the two WithContext methods. +// This was unintentional, but fixing it now would force the ecosystem +// to go through a breaking Go API change and was deemed not worth it. +// // NewFilteredListWatchFromClient sets all of the functions to ensure that callers // which only know about ListFunc and WatchFunc continue to work. type ListWatch struct {