From 986db350b47565ba20fcd55b6475cef2eb6f43d0 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Mon, 23 Oct 2023 20:55:28 +0000 Subject: [PATCH] cluster: make unreachable panic explicit making revive 1.3.4 happy Signed-off-by: Alejandro Mery --- pkg/cluster/cluster_file.go | 6 +++++- pkg/cluster/machine_file.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/cluster/cluster_file.go b/pkg/cluster/cluster_file.go index 306b3f2..e1deb11 100644 --- a/pkg/cluster/cluster_file.go +++ b/pkg/cluster/cluster_file.go @@ -33,7 +33,11 @@ func (m *Cluster) openWriter(name string, flags int, args ...any) (io.WriteClose return nil, err } - return f.(io.WriteCloser), nil + if f, ok := f.(io.WriteCloser); ok { + return f, nil + } + + panic("unreachable") } // ReadFile reads a file from the cluster's config directory diff --git a/pkg/cluster/machine_file.go b/pkg/cluster/machine_file.go index a6e90eb..40dde3a 100644 --- a/pkg/cluster/machine_file.go +++ b/pkg/cluster/machine_file.go @@ -34,7 +34,11 @@ func (m *Machine) openWriter(name string, flags int, args ...any) (io.WriteClose return nil, err } - return f.(io.WriteCloser), nil + if f, ok := f.(io.WriteCloser); ok { + return f, nil + } + + panic("unreachable") } // RemoveFile deletes a file from the machine's config directory