summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--argv.go11
-rw-r--r--buildPackage.go12
2 files changed, 14 insertions, 9 deletions
diff --git a/argv.go b/argv.go
index f01e98b..ea1ec8d 100644
--- a/argv.go
+++ b/argv.go
@@ -15,11 +15,12 @@ import (
var argv args
type args struct {
- NoGui bool `arg:"--no-gui" help:"don't open the gui, just make the .deb"`
- Ldflags []string `arg:"--ldflags" help:"flags to pass to go build"`
- Repo string `arg:"--repo" help:"go get path to the repo"`
- PkgDir string `arg:"--pkg-dir" help:"set default directory (~/incoming/)"`
- Release bool `arg:"--release" help:"build a release from the last git tag"`
+ NoGui bool `arg:"--no-gui" help:"don't open the gui, just make the .deb"`
+ Ldflags []string `arg:"--ldflags" help:"flags to pass to go build"`
+ Repo string `arg:"--repo" help:"go get path to the repo"`
+ PkgDir string `arg:"--pkg-dir" help:"set default directory (~/incoming/)"`
+ Release bool `arg:"--release" help:"build a release from the last git tag"`
+ KeepFiles bool `arg:"--keep-files" help:"keep the build files/"`
}
func init() {
diff --git a/buildPackage.go b/buildPackage.go
index 95c76bb..bf201c3 100644
--- a/buildPackage.go
+++ b/buildPackage.go
@@ -81,7 +81,7 @@ func (c *controlBox) buildPackage() (bool, error) {
// add any flags from the command line
for _, flag := range argv.Ldflags {
- cmd = append(cmd, "-ldflags", "-X " + flag)
+ cmd = append(cmd, "-ldflags", "-X "+flag)
}
if shell.Run(cmd) {
@@ -174,9 +174,13 @@ func (c *controlBox) buildPackage() (bool, error) {
// cleanup files
if shell.Exists("files") {
- if shell.Run([]string{"rm", "-rf", "files"}) {
- log.Warn("rm failed")
- return false, errors.New("rm files/")
+ if argv.KeepFiles {
+ log.Info("keeping the build files/")
+ } else {
+ if shell.Run([]string{"rm", "-rf", "files"}) {
+ log.Warn("rm failed")
+ return false, errors.New("rm files/")
+ }
}
}
return true, nil