X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=inline;f=vendor%2Fgithub.com%2Fhashicorp%2Fterraform%2Fhelper%2Fhashcode%2Fhashcode.go;h=6ccc52318348b5383c0e4559a410a53e78c6f7e5;hb=15c0b25d011f37e7c20aeca9eaf461f78285b8d9;hp=64d8263e6014a98fd1c37c2c06daa249538048c8;hpb=07971ca38143c5faf951d152fba370ddcbe26ad5;p=github%2Ffretlink%2Fterraform-provider-statuscake.git 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 @@ 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())) +}