diff options
Diffstat (limited to 'recipes-devtools/go-dirhash-native/go-dirhash')
| -rw-r--r-- | recipes-devtools/go-dirhash-native/go-dirhash/LICENSE | 26 | ||||
| -rw-r--r-- | recipes-devtools/go-dirhash-native/go-dirhash/dirhash-helper.go | 24 |
2 files changed, 50 insertions, 0 deletions
diff --git a/recipes-devtools/go-dirhash-native/go-dirhash/LICENSE b/recipes-devtools/go-dirhash-native/go-dirhash/LICENSE new file mode 100644 index 00000000..9feb7621 --- /dev/null +++ b/recipes-devtools/go-dirhash-native/go-dirhash/LICENSE | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | Copyright (c) 2009 The Go Authors. All rights reserved. | ||
| 2 | |||
| 3 | Redistribution and use in source and binary forms, with or without | ||
| 4 | modification, are permitted provided that the following conditions are met: | ||
| 5 | |||
| 6 | * Redistributions of source code must retain the above copyright | ||
| 7 | notice, this list of conditions and the following disclaimer. | ||
| 8 | * Redistributions in binary form must reproduce the above copyright | ||
| 9 | notice, this list of conditions and the following disclaimer in | ||
| 10 | the documentation and/or other materials provided with the | ||
| 11 | distribution. | ||
| 12 | * Neither the name of Google Inc. nor the names of its | ||
| 13 | contributors may be used to endorse or promote products derived | ||
| 14 | from this software without specific prior written permission. | ||
| 15 | |||
| 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 17 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 18 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 19 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 20 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 22 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
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 @@ | |||
| 1 | package main | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "fmt" | ||
| 5 | "os" | ||
| 6 | |||
| 7 | "golang.org/x/mod/sumdb/dirhash" | ||
| 8 | ) | ||
| 9 | |||
| 10 | func 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 | } | ||
