mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
Removed internal version implementation
This commit is contained in:
parent
c8297534cc
commit
331c515ad2
1 changed files with 0 additions and 42 deletions
|
|
@ -1,42 +0,0 @@
|
||||||
package magellan
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os/exec"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// VersionCommit() returns a string with 'r{commit_count}.{commit_version}' format.
|
|
||||||
func VersionCommit() string {
|
|
||||||
var (
|
|
||||||
version string
|
|
||||||
revlist []byte
|
|
||||||
revparse []byte
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
revlist, err = exec.Command("git", "rev-list", "--count", "HEAD").Output()
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
revparse, err = exec.Command("git", "rev-parse", "--short", "HEAD").Output()
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
version = fmt.Sprintf("r%s.%s", strings.TrimRight(string(revlist), "\n"), string(revparse))
|
|
||||||
return strings.TrimRight(version, "\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
// VersionTag() returns a string with format '{git_tag}' using the `git describe` command.
|
|
||||||
func VersionTag() string {
|
|
||||||
var (
|
|
||||||
describe []byte
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
describe, err = exec.Command("git", "describe", "--long", "HEAD").Output()
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
return strings.TrimRight(string(describe), "\n")
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue