summaryrefslogtreecommitdiff
path: root/internal/file/file.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-07-04 21:00:42 +0300
committerPaul Buetow <paul@buetow.org>2026-07-04 21:00:42 +0300
commit1f6334b0e6748b2bbdecc3ffb56b0f7a26290001 (patch)
tree8e079a7a5db2c27190a263c7dcde85f1860c1c87 /internal/file/file.go
parent6a3cae2f434e84d926eee88db0e9ab26767380e7 (diff)
register file resource automatically
Diffstat (limited to 'internal/file/file.go')
-rw-r--r--internal/file/file.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/internal/file/file.go b/internal/file/file.go
index b230473..ee759e0 100644
--- a/internal/file/file.go
+++ b/internal/file/file.go
@@ -4,8 +4,15 @@ import (
"crypto/sha256"
"log"
"os"
+
+ "codeberg.org/snonux/gonf/internal/resource"
)
+func HaveString(path, content string) error {
+ _ = resource.Register("File", path)
+ return have(path, []byte(content))
+}
+
func getChecksum(path string) [32]byte {
var checksum [32]byte
data, err := os.ReadFile(path)
@@ -62,7 +69,3 @@ func have(path string, content []byte) error {
return updateFromTmp(tmpPath, path, existingChecksum != newChecksum)
}
-
-func HaveString(path, content string) error {
- return have(path, []byte(content))
-}