Skip to content

Commit

Permalink
fix: Warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Vaerh <[email protected]>
  • Loading branch information
vaerh committed Oct 26, 2023
1 parent 3b0f2a7 commit a761f5d
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions cid/iso.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"os"
"os/exec"
"path/filepath"
"reflect"
)

var (
Expand All @@ -27,8 +26,6 @@ var (
return []string{"-as", "genisoimage", "-rock", "-joliet", "-volid", isoLabel, "-output", dst, src}
},
}

readCloserType = reflect.TypeOf((*io.ReadCloser)(nil)).Elem()
)

type Iso struct {
Expand All @@ -46,11 +43,11 @@ func NewISOWriter(isoMakerCommand string) (*Iso, error) {

// data is io.Reader or io.ReadCloser
func (i *Iso) AddFile(data any, filePath string) {
switch data.(type) {
case io.Reader:
i.files[filePath] = io.NopCloser(data.(io.Reader))
switch data := data.(type) {
case io.ReadCloser:
i.files[filePath] = data.(io.ReadCloser)
i.files[filePath] = data
case io.Reader:
i.files[filePath] = io.NopCloser(data)
default:
panic("Method not applicable for types other than io.Reader or io.ReadCloser")
}
Expand Down

0 comments on commit a761f5d

Please sign in to comment.