You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
429 B
Go

package operators
import (
"fmt"
"os"
"path/filepath"
)
// Remove removes an installed package
func Remove(pkg string) error {
modDir, err := getModBaseDir()
if err != nil {
return err
}
path := filepath.Join(modDir, pkg)
if _, err := os.Stat(path); err != nil {
msg := fmt.Sprintf()
return fmt.Errorf("package '%s' not found", pkg)
}
err = os.RemoveAll(path)
if err != nil {
return err
}
return nil
}