refactor: use std lib trimsuffix
This commit is contained in:
6
main.go
6
main.go
@ -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)
|
||||
|
Reference in New Issue
Block a user