refactor: use std lib trimsuffix

This commit is contained in:
Jan Bader
2025-01-28 15:08:08 +01:00
parent 224a6bc9af
commit 8e86f9eb9a
3 changed files with 4 additions and 16 deletions

View File

@ -76,8 +76,8 @@ func removeSuffix(suffix string) filepath.WalkFunc {
dir := filepath.Dir(p)
ext := filepath.Ext(filename)
filenameNoExt := trimSuffix(filename, ext)
filenameNoSuff := trimSuffix(filenameNoExt, suffix)
filenameNoExt := strings.TrimSuffix(filename, ext)
filenameNoSuff := strings.TrimSuffix(filenameNoExt, suffix)
if filenameNoSuff != filenameNoExt {
newFilename := filenameNoSuff + ext
@ -132,7 +132,7 @@ func unpack(p string, f os.FileInfo, err error) error {
}
cmd := exec.Command(execCmd, p)
filename = trimSuffix(filename, ext)
filename = strings.TrimSuffix(filename, ext)
ext = filepath.Ext(filename)
if ext == "" {
fmt.Println(p)