diff --git a/misc/chdir.go b/misc/chdir.go new file mode 100644 index 0000000..59be27e --- /dev/null +++ b/misc/chdir.go @@ -0,0 +1,7 @@ +package misc + +import "os" + +func Chdir(codepath string) error { + return os.Chdir(codepath) +} diff --git a/misc/git_clone.go b/misc/git_clone.go new file mode 100644 index 0000000..79bfebb --- /dev/null +++ b/misc/git_clone.go @@ -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() +} diff --git a/misc/git_pull.go b/misc/git_pull.go new file mode 100644 index 0000000..d2df85c --- /dev/null +++ b/misc/git_pull.go @@ -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() +} diff --git a/misc/git_reset.go b/misc/git_reset.go new file mode 100644 index 0000000..b8e4507 --- /dev/null +++ b/misc/git_reset.go @@ -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() +} diff --git a/misc/go_build.go b/misc/go_build.go new file mode 100644 index 0000000..3ea1866 --- /dev/null +++ b/misc/go_build.go @@ -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() +} diff --git a/misc/go_mod_tidy.go b/misc/go_mod_tidy.go new file mode 100644 index 0000000..ab48c84 --- /dev/null +++ b/misc/go_mod_tidy.go @@ -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() +} diff --git a/misc/go_test.go b/misc/go_test.go new file mode 100644 index 0000000..9b51cea --- /dev/null +++ b/misc/go_test.go @@ -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() +}