Embed git tag as version number
parent
9015c0332e
commit
a3ab544446
@ -1,2 +1,3 @@
|
|||||||
bin/
|
bin/
|
||||||
librnnoise.go
|
librnnoise.go
|
||||||
|
version.go
|
@ -0,0 +1,24 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
cmd := exec.Command("git", "describe", "--tags")
|
||||||
|
ret, err := cmd.Output()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
panic("Couldn't read git tags to embed version number")
|
||||||
|
}
|
||||||
|
version := strings.TrimSpace(string(ret))
|
||||||
|
|
||||||
|
out, _ := os.Create("version.go")
|
||||||
|
defer out.Close()
|
||||||
|
|
||||||
|
out.Write([]byte("package main \n\nvar version=\""))
|
||||||
|
out.Write([]byte(version))
|
||||||
|
out.Write([]byte("\"\n"))
|
||||||
|
}
|
Loading…
Reference in New Issue