From 7f7ccf36e319babee142f4835441a38919fd918b Mon Sep 17 00:00:00 2001 From: Paul Tyng Date: Wed, 13 May 2020 13:55:51 -0400 Subject: [PATCH 1/3] Deprecated packages that were removed in v2 See #438 --- helper/hashcode/hashcode.go | 8 ++++++++ helper/mutexkv/mutexkv.go | 12 ++++++++++++ helper/pathorcontents/read.go | 3 +++ httpclient/useragent.go | 4 ++++ 4 files changed, 27 insertions(+) diff --git a/helper/hashcode/hashcode.go b/helper/hashcode/hashcode.go index 6ccc5231834..c467e17c21d 100644 --- a/helper/hashcode/hashcode.go +++ b/helper/hashcode/hashcode.go @@ -8,6 +8,10 @@ import ( // String hashes a string to a unique hashcode. // +// Deprecated: This will be removed in v2 without replacement. If you need +// its functionality, you can copy it, use crc32 directory, or reference the +// v1 package. +// // crc32 returns a uint32, but for our use we need // and non negative integer. Here we cast to an integer // and invert it if the result is negative. @@ -24,6 +28,10 @@ func String(s string) int { } // Strings hashes a list of strings to a unique hashcode. +// +// Deprecated: This will be removed in v2 without replacement. If you need +// its functionality, you can copy it, use crc32 directory, or reference the +// v1 package. func Strings(strings []string) string { var buf bytes.Buffer diff --git a/helper/mutexkv/mutexkv.go b/helper/mutexkv/mutexkv.go index 6917f2142bd..427ac9c88ad 100644 --- a/helper/mutexkv/mutexkv.go +++ b/helper/mutexkv/mutexkv.go @@ -9,6 +9,9 @@ import ( // serialize changes across arbitrary collaborators that share knowledge of the // keys they must serialize on. // +// Deprecated: This will be removed in v2 without replacement. If you need +// its functionality, you can copy it or reference the v1 package. +// // The initial use case is to let aws_security_group_rule resources serialize // their access to individual security groups based on SG ID. type MutexKV struct { @@ -18,6 +21,9 @@ type MutexKV struct { // Locks the mutex for the given key. Caller is responsible for calling Unlock // for the same key +// +// Deprecated: This will be removed in v2 without replacement. If you need +// its functionality, you can copy it or reference the v1 package. func (m *MutexKV) Lock(key string) { log.Printf("[DEBUG] Locking %q", key) m.get(key).Lock() @@ -25,6 +31,9 @@ func (m *MutexKV) Lock(key string) { } // Unlock the mutex for the given key. Caller must have called Lock for the same key first +// +// Deprecated: This will be removed in v2 without replacement. If you need +// its functionality, you can copy it or reference the v1 package. func (m *MutexKV) Unlock(key string) { log.Printf("[DEBUG] Unlocking %q", key) m.get(key).Unlock() @@ -44,6 +53,9 @@ func (m *MutexKV) get(key string) *sync.Mutex { } // Returns a properly initalized MutexKV +// +// Deprecated: This will be removed in v2 without replacement. If you need +// its functionality, you can copy it or reference the v1 package. func NewMutexKV() *MutexKV { return &MutexKV{ store: make(map[string]*sync.Mutex), diff --git a/helper/pathorcontents/read.go b/helper/pathorcontents/read.go index d0d4847daeb..bf050f8af32 100644 --- a/helper/pathorcontents/read.go +++ b/helper/pathorcontents/read.go @@ -12,6 +12,9 @@ import ( // otherwise the argument is assumed to be the desired contents and is simply // returned. // +// Deprecated: This will be removed in v2 without replacement. If you need +// its functionality, you can copy it or reference the v1 package. +// // The boolean second return value can be called `wasPath` - it indicates if a // path was detected and a file loaded. func Read(poc string) (string, bool, error) { diff --git a/httpclient/useragent.go b/httpclient/useragent.go index 36b494c0149..158b499e7c3 100644 --- a/httpclient/useragent.go +++ b/httpclient/useragent.go @@ -11,6 +11,10 @@ import ( const uaEnvVar = "TF_APPEND_USER_AGENT" +// TerraformUserAgent returns a User-Agent header for a Terraform version string. +// +// Deprecated: This will be removed in v2 without replacement. If you need +// its functionality, you can copy it or reference the v1 package. func TerraformUserAgent(version string) string { ua := fmt.Sprintf("HashiCorp Terraform/%s (+https://www.terraform.io) Terraform Plugin SDK/%s", version, meta.SDKVersionString()) From e74bc52789cf01de52bbd4af1138066bf2e8a233 Mon Sep 17 00:00:00 2001 From: Paul Tyng Date: Wed, 13 May 2020 14:10:34 -0400 Subject: [PATCH 2/3] Update helper/hashcode/hashcode.go Co-authored-by: appilon --- helper/hashcode/hashcode.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helper/hashcode/hashcode.go b/helper/hashcode/hashcode.go index c467e17c21d..ea6062b4db7 100644 --- a/helper/hashcode/hashcode.go +++ b/helper/hashcode/hashcode.go @@ -9,7 +9,7 @@ import ( // String hashes a string to a unique hashcode. // // Deprecated: This will be removed in v2 without replacement. If you need -// its functionality, you can copy it, use crc32 directory, or reference the +// its functionality, you can copy it, import crc32 directly, or reference the // v1 package. // // crc32 returns a uint32, but for our use we need From 927a078ac10b325911f82bc660cb8a2538b065ba Mon Sep 17 00:00:00 2001 From: Paul Tyng Date: Wed, 13 May 2020 14:11:21 -0400 Subject: [PATCH 3/3] Update helper/hashcode/hashcode.go Co-authored-by: appilon --- helper/hashcode/hashcode.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helper/hashcode/hashcode.go b/helper/hashcode/hashcode.go index ea6062b4db7..f0c022dd235 100644 --- a/helper/hashcode/hashcode.go +++ b/helper/hashcode/hashcode.go @@ -30,7 +30,7 @@ func String(s string) int { // Strings hashes a list of strings to a unique hashcode. // // Deprecated: This will be removed in v2 without replacement. If you need -// its functionality, you can copy it, use crc32 directory, or reference the +// its functionality, you can copy it, import crc32 directly, or reference the // v1 package. func Strings(strings []string) string { var buf bytes.Buffer