version/main.go
2025-04-20 02:00:13 +03:00

24 lines
422 B
Go

package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
)
const header = "package main\nconst Value = \""
func main() {
cmd := exec.Command("git", "describe", "--tags", "--abbrev=0")
out, err := cmd.Output()
if err != nil {
fmt.Println(err)
os.Exit(0)
}
version := string(out)
version = version[:len(version)-1]
content := header + version + "\""
ioutil.WriteFile("version.go", []byte(content), 0644)
}