parent
9fc1f83003
commit
571f1b95fe
@ -0,0 +1,7 @@ |
||||
package misc |
||||
|
||||
import "os" |
||||
|
||||
func Chdir(codepath string) error { |
||||
return os.Chdir(codepath) |
||||
} |
@ -0,0 +1,28 @@ |
||||
package misc |
||||
|
||||
import ( |
||||
"os" |
||||
"os/exec" |
||||
) |
||||
|
||||
func GitClone() error { |
||||
cmd := exec.Command("git", "clone", "https://github.com/HupeHup/hupe.git", "gittemp") |
||||
cmd.Stdout = os.Stdout |
||||
cmd.Stderr = os.Stderr |
||||
cmd.Stdin = os.Stdin |
||||
if err := cmd.Run(); err != nil { |
||||
return err |
||||
} |
||||
|
||||
cmd = exec.Command("mv", "gittemp/.git", ".") |
||||
cmd.Stdout = os.Stdout |
||||
cmd.Stderr = os.Stderr |
||||
if err := cmd.Run(); err != nil { |
||||
return err |
||||
} |
||||
|
||||
cmd = exec.Command("rm", "-rf", "gittemp") |
||||
cmd.Stdout = os.Stdout |
||||
cmd.Stderr = os.Stderr |
||||
return cmd.Run() |
||||
} |
@ -0,0 +1,14 @@ |
||||
package misc |
||||
|
||||
import ( |
||||
"os" |
||||
"os/exec" |
||||
) |
||||
|
||||
func GitPull() error { |
||||
cmd := exec.Command("git", "pull") |
||||
cmd.Stdout = os.Stdout |
||||
cmd.Stderr = os.Stderr |
||||
cmd.Stdin = os.Stdin |
||||
return cmd.Run() |
||||
} |
@ -0,0 +1,14 @@ |
||||
package misc |
||||
|
||||
import ( |
||||
"os" |
||||
"os/exec" |
||||
) |
||||
|
||||
func GitRest() error { |
||||
cmd := exec.Command("git", "reset", "--hard", "origin/main") |
||||
cmd.Stdout = os.Stdout |
||||
cmd.Stderr = os.Stderr |
||||
cmd.Stdin = os.Stdin |
||||
return cmd.Run() |
||||
} |
@ -0,0 +1,14 @@ |
||||
package misc |
||||
|
||||
import ( |
||||
"os" |
||||
"os/exec" |
||||
) |
||||
|
||||
func GoBuild() error { |
||||
cmd := exec.Command("go", "build", "-ldflags", "\"-w-s\"", "-trimpath", "path/to/main.go", "-o", "main") |
||||
cmd.Stdout = os.Stdout |
||||
cmd.Stderr = os.Stderr |
||||
cmd.Stdin = os.Stdin |
||||
return cmd.Run() |
||||
} |
@ -0,0 +1,14 @@ |
||||
package misc |
||||
|
||||
import ( |
||||
"os" |
||||
"os/exec" |
||||
) |
||||
|
||||
func GoModTidy() error { |
||||
cmd := exec.Command("go", "mod", "tidy") |
||||
cmd.Stdout = os.Stdout |
||||
cmd.Stderr = os.Stderr |
||||
cmd.Stdin = os.Stdin |
||||
return cmd.Run() |
||||
} |
@ -0,0 +1,14 @@ |
||||
package misc |
||||
|
||||
import ( |
||||
"os" |
||||
"os/exec" |
||||
) |
||||
|
||||
func GoTest() error { |
||||
cmd := exec.Command("go", "test", "-v") |
||||
cmd.Stdout = os.Stdout |
||||
cmd.Stderr = os.Stderr |
||||
cmd.Stdin = os.Stdin |
||||
return cmd.Run() |
||||
} |
Loading…
Reference in new issue