Skip to content

Commit cd266a5

Browse files
committed
fix: add //go:noinline to isMinikubeExtension to ensure recover() works
Without noinline, newer Go versions inline isMinikubeExtension into its caller, which means the deferred recover() loses its own stack frame and cannot catch the panic from ToUnstructured. Signed-off-by: Ben Mosher <ben.mosher@dbtlabs.com>
1 parent 5427dc2 commit cd266a5

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

pkg/devspace/kubectl/util.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,11 @@ func IsMinikubeKubernetes(kubeClient Client) bool {
272272
// panics on such values via reflection ("reflect.Set: value of type string is
273273
// not assignable to type map[string]interface {}") rather than returning an
274274
// error, so we recover() and treat unparseable extensions as non-minikube.
275+
//
276+
// noinline is required: if the compiler inlines this function into its caller,
277+
// the deferred recover() loses its stack frame and cannot catch the panic.
278+
//
279+
//go:noinline
275280
func isMinikubeExtension(extension runtime.Object) (result bool) {
276281
defer func() {
277282
if recover() != nil {

0 commit comments

Comments
 (0)