feat(refacto): move everything in internal package

This allows to install katenary with `go install` and to clean up the
project folder.
This commit is contained in:
2025-08-03 15:54:58 +02:00
parent d1768e5742
commit 14ca5bf0ea
91 changed files with 291 additions and 282 deletions

26
internal/utils/hash.go Normal file
View File

@@ -0,0 +1,26 @@
package utils
import (
"crypto/sha1"
"encoding/hex"
"io"
"os"
"sort"
)
// HashComposefiles returns a hash of the compose files.
func HashComposefiles(files []string) (string, error) {
sort.Strings(files) // ensure the order is always the same
sha := sha1.New()
for _, file := range files {
f, err := os.Open(file)
if err != nil {
return "", err
}
defer f.Close()
if _, err := io.Copy(sha, f); err != nil {
return "", err
}
}
return hex.EncodeToString(sha.Sum(nil)), nil
}