parent
5b0591ffad
commit
b010fd0ff3
@ -1,18 +0,0 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
CONST_FILE=build-constants.go |
||||
|
||||
cat > $CONST_FILE <<EOF |
||||
/* |
||||
* ** DO NOT EDIT THIS FILE. THIS FILE IS AUTO GENERATED BY RUNNING MAKE ** |
||||
*/ |
||||
|
||||
package main |
||||
|
||||
const ( |
||||
minioGitCommitHash = "__GIT_COMMIT_HASH__" |
||||
) |
||||
EOF |
||||
|
||||
commit_id=$(git log --format="%H" -n 1) |
||||
sed -i "s/__GIT_COMMIT_HASH__/$commit_id/" $CONST_FILE |
@ -0,0 +1,28 @@ |
||||
package main |
||||
|
||||
import ( |
||||
"fmt" |
||||
"io" |
||||
"os" |
||||
|
||||
"crypto/md5" |
||||
) |
||||
|
||||
// mustHashBinarySelf computes MD5SUM of a binary file on disk
|
||||
func hashBinary(progName string) (string, error) { |
||||
h := md5.New() |
||||
|
||||
file, err := os.Open(progName) // For read access.
|
||||
if err != nil { |
||||
return "", err |
||||
} |
||||
|
||||
io.Copy(h, file) |
||||
return fmt.Sprintf("%x", h.Sum(nil)), nil |
||||
} |
||||
|
||||
// mustHashBinarySelf computes MD5SUM of its binary file on disk
|
||||
func mustHashBinarySelf() string { |
||||
hash, _ := hashBinary(os.Args[0]) |
||||
return hash |
||||
} |
Loading…
Reference in new issue