]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/hashicorp/terraform/helper/hashcode/hashcode.go
deps: github.com/hashicorp/terraform@sdk-v0.11-with-go-modules
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / terraform / helper / hashcode / hashcode.go
index 64d8263e6014a98fd1c37c2c06daa249538048c8..6ccc52318348b5383c0e4559a410a53e78c6f7e5 100644 (file)
@@ -1,6 +1,8 @@
 package hashcode
 
 import (
+       "bytes"
+       "fmt"
        "hash/crc32"
 )
 
@@ -20,3 +22,14 @@ func String(s string) int {
        // v == MinInt
        return 0
 }
+
+// Strings hashes a list of strings to a unique hashcode.
+func Strings(strings []string) string {
+       var buf bytes.Buffer
+
+       for _, s := range strings {
+               buf.WriteString(fmt.Sprintf("%s-", s))
+       }
+
+       return fmt.Sprintf("%d", String(buf.String()))
+}