aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/terraform/helper/hashcode
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/helper/hashcode')
-rw-r--r--vendor/github.com/hashicorp/terraform/helper/hashcode/hashcode.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/helper/hashcode/hashcode.go b/vendor/github.com/hashicorp/terraform/helper/hashcode/hashcode.go
index 64d8263..6ccc523 100644
--- a/vendor/github.com/hashicorp/terraform/helper/hashcode/hashcode.go
+++ b/vendor/github.com/hashicorp/terraform/helper/hashcode/hashcode.go
@@ -1,6 +1,8 @@
1package hashcode 1package hashcode
2 2
3import ( 3import (
4 "bytes"
5 "fmt"
4 "hash/crc32" 6 "hash/crc32"
5) 7)
6 8
@@ -20,3 +22,14 @@ func String(s string) int {
20 // v == MinInt 22 // v == MinInt
21 return 0 23 return 0
22} 24}
25
26// Strings hashes a list of strings to a unique hashcode.
27func Strings(strings []string) string {
28 var buf bytes.Buffer
29
30 for _, s := range strings {
31 buf.WriteString(fmt.Sprintf("%s-", s))
32 }
33
34 return fmt.Sprintf("%d", String(buf.String()))
35}