forked from mcandre/mx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.go
More file actions
38 lines (30 loc) · 798 Bytes
/
Copy pathinstall.go
File metadata and controls
38 lines (30 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package mageextras
import (
"os"
"os/exec"
"path"
"github.com/magefile/mage/mg"
)
// Install builds and installs Go applications.
func Install(args ...string) error {
cmdName := "go"
cmdParameters := []string{cmdName}
cmdParameters = append(cmdParameters, "install")
cmdParameters = append(cmdParameters, args...)
cmdParameters = append(cmdParameters, AllPackagesPath)
cmd := exec.Command(cmdName)
cmd.Args = cmdParameters
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}
// Uninstall deletes installed Go applications.
func Uninstall(applications ...string) error {
mg.Deps(LoadGoBinariesPath)
for _, application := range applications {
if err := os.RemoveAll(path.Join(LoadedGoBinariesPath, application)); err != nil {
return err
}
}
return nil
}