summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/go-dirhash-native/go-dirhash/dirhash-helper.go
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-devtools/go-dirhash-native/go-dirhash/dirhash-helper.go')
-rw-r--r--recipes-devtools/go-dirhash-native/go-dirhash/dirhash-helper.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/recipes-devtools/go-dirhash-native/go-dirhash/dirhash-helper.go b/recipes-devtools/go-dirhash-native/go-dirhash/dirhash-helper.go
new file mode 100644
index 00000000..d2aec41c
--- /dev/null
+++ b/recipes-devtools/go-dirhash-native/go-dirhash/dirhash-helper.go
@@ -0,0 +1,24 @@
1package main
2
3import (
4 "fmt"
5 "os"
6
7 "golang.org/x/mod/sumdb/dirhash"
8)
9
10func main() {
11 if len(os.Args) != 2 {
12 fmt.Fprintf(os.Stderr, "Usage: %s <zip-file>\n", os.Args[0])
13 os.Exit(1)
14 }
15
16 zipPath := os.Args[1]
17 hash, err := dirhash.HashZip(zipPath, dirhash.DefaultHash)
18 if err != nil {
19 fmt.Fprintf(os.Stderr, "Error: %v\n", err)
20 os.Exit(1)
21 }
22
23 fmt.Println(hash)
24}