aboutsummaryrefslogtreecommitdiffstats
path: root/internal/build/util.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-11-21 19:44:42 +0800
committerFelix Lange <fjl@twurst.com>2016-11-23 17:40:22 +0800
commite1e2df656a46c428bfb487e5ec3d126905ff003e (patch)
tree7b363803a560cafb668b2bbfa47dfcae5684936d /internal/build/util.go
parent92959cd4ef1369bc5338169d209945bb5be6b53b (diff)
downloaddexon-e1e2df656a46c428bfb487e5ec3d126905ff003e.tar
dexon-e1e2df656a46c428bfb487e5ec3d126905ff003e.tar.gz
dexon-e1e2df656a46c428bfb487e5ec3d126905ff003e.tar.bz2
dexon-e1e2df656a46c428bfb487e5ec3d126905ff003e.tar.lz
dexon-e1e2df656a46c428bfb487e5ec3d126905ff003e.tar.xz
dexon-e1e2df656a46c428bfb487e5ec3d126905ff003e.tar.zst
dexon-e1e2df656a46c428bfb487e5ec3d126905ff003e.zip
internal/build: add support for git tag in local Environment
I didn't add this initially because the command I tried was too slow. The 'git for-each-ref ...' invocation takes 40ms on my machine. That ought to be acceptable.
Diffstat (limited to 'internal/build/util.go')
-rw-r--r--internal/build/util.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/build/util.go b/internal/build/util.go
index c7e0614f2..1523a067b 100644
--- a/internal/build/util.go
+++ b/internal/build/util.go
@@ -76,6 +76,8 @@ func VERSION() string {
return string(bytes.TrimSpace(version))
}
+var warnedAboutGit bool
+
// RunGit runs a git subcommand and returns its output.
// The command must complete successfully.
func RunGit(args ...string) string {
@@ -83,7 +85,10 @@ func RunGit(args ...string) string {
var stdout, stderr bytes.Buffer
cmd.Stdout, cmd.Stderr = &stdout, &stderr
if err := cmd.Run(); err == exec.ErrNotFound {
- log.Println("no git in PATH")
+ if !warnedAboutGit {
+ log.Println("Warning: can't find 'git' in PATH")
+ warnedAboutGit = true
+ }
return ""
} else if err != nil {
log.Fatal(strings.Join(cmd.Args, " "), ": ", err, "\n", stderr.String())