Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated packages that were removed in v2 #453

Merged
merged 3 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions helper/hashcode/hashcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, import crc32 directly, 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.
Expand All @@ -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, import crc32 directly, or reference the
// v1 package.
func Strings(strings []string) string {
var buf bytes.Buffer

Expand Down
12 changes: 12 additions & 0 deletions helper/mutexkv/mutexkv.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -18,13 +21,19 @@ 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()
log.Printf("[DEBUG] Locked %q", key)
}

// 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()
Expand All @@ -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),
Expand Down
3 changes: 3 additions & 0 deletions helper/pathorcontents/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions httpclient/useragent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down