You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-07-03 00:57:43 +02:00
ldflags template
This commit is contained in:
21
pipeline/git/commit.go
Normal file
21
pipeline/git/commit.go
Normal file
@ -0,0 +1,21 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func commitHash() (string, error) {
|
||||
cmd := exec.Command(
|
||||
"git",
|
||||
"show",
|
||||
"--format='%H'",
|
||||
"HEAD",
|
||||
)
|
||||
bts, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return "", errors.New(err.Error() + ": " + string(bts))
|
||||
}
|
||||
return strings.Replace(strings.Split(string(bts), "\n")[0], "'", "", -1), err
|
||||
}
|
Reference in New Issue
Block a user