You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NoiseTorch/scripts/embedversion.go

25 lines
504 B
Go

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\n//THIS FILE IS AUTOMATICALLY GENERATED BY `go generate` DO NOT EDIT!\n\nvar version=\""))
out.Write([]byte(version))
out.Write([]byte("\"\n"))
}