Add check command

This commit is contained in:
kolaente 2020-09-02 21:42:19 +02:00
parent 46fd8b9daf
commit 5534b163cb
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 23 additions and 0 deletions

View File

@ -498,6 +498,29 @@ func (Release) Copy() {
})
}
// Creates sha256 checksum files for each binary in dist/release/
func (Release) Check() error {
p := RootPath + "/" + DIST + "/release/"
return filepath.Walk(p, func(path string, info os.FileInfo, err error) error {
f, err := os.Create(p + info.Name() + ".sha256")
if err != nil {
return err
}
hash, err := calculateSha256FileHash(path)
if err != nil {
return err
}
_, err = f.WriteString(hash + " " + info.Name())
if err != nil {
return err
}
return f.Close()
})
}
// Creates a folder for each
func (Release) OsPackage() error {