From 9f2a6d33bea573adbdcd5bc7dabc55dc74c0c755 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 20 Jan 2021 13:18:02 -0500 Subject: [PATCH] move remaining helper packages to internal --- backend/remote-state/azure/backend_test.go | 2 +- backend/remote-state/azure/client_test.go | 2 +- command/clistate/state.go | 2 +- command/console.go | 2 +- command/console_interactive.go | 2 +- helper/README.md | 9 --------- {helper => internal/helper}/slowmessage/slowmessage.go | 0 .../helper}/slowmessage/slowmessage_test.go | 0 .../helper}/wrappedreadline/wrappedreadline.go | 2 +- .../helper}/wrappedreadline/wrappedreadline_unix.go | 2 +- .../helper}/wrappedreadline/wrappedreadline_windows.go | 0 {helper => internal/helper}/wrappedstreams/streams.go | 0 .../helper}/wrappedstreams/streams_other.go | 0 .../helper}/wrappedstreams/streams_windows.go | 0 {helper => internal/legacy/helper}/acctest/acctest.go | 0 {helper => internal/legacy/helper}/acctest/random.go | 0 .../legacy/helper}/acctest/random_test.go | 0 .../legacy/helper}/acctest/remotetests.go | 0 {helper => internal/legacy/helper}/hashcode/hashcode.go | 0 .../legacy/helper}/hashcode/hashcode_test.go | 0 .../legacy/helper/schema/field_reader_config_test.go | 2 +- internal/legacy/helper/schema/schema_test.go | 2 +- internal/legacy/helper/schema/set.go | 2 +- internal/legacy/helper/schema/shims_test.go | 2 +- 24 files changed, 11 insertions(+), 20 deletions(-) delete mode 100644 helper/README.md rename {helper => internal/helper}/slowmessage/slowmessage.go (100%) rename {helper => internal/helper}/slowmessage/slowmessage_test.go (100%) rename {helper => internal/helper}/wrappedreadline/wrappedreadline.go (96%) rename {helper => internal/helper}/wrappedreadline/wrappedreadline_unix.go (91%) rename {helper => internal/helper}/wrappedreadline/wrappedreadline_windows.go (100%) rename {helper => internal/helper}/wrappedstreams/streams.go (100%) rename {helper => internal/helper}/wrappedstreams/streams_other.go (100%) rename {helper => internal/helper}/wrappedstreams/streams_windows.go (100%) rename {helper => internal/legacy/helper}/acctest/acctest.go (100%) rename {helper => internal/legacy/helper}/acctest/random.go (100%) rename {helper => internal/legacy/helper}/acctest/random_test.go (100%) rename {helper => internal/legacy/helper}/acctest/remotetests.go (100%) rename {helper => internal/legacy/helper}/hashcode/hashcode.go (100%) rename {helper => internal/legacy/helper}/hashcode/hashcode_test.go (100%) diff --git a/backend/remote-state/azure/backend_test.go b/backend/remote-state/azure/backend_test.go index 3f0a28534..9d9d2d3ae 100644 --- a/backend/remote-state/azure/backend_test.go +++ b/backend/remote-state/azure/backend_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hashicorp/terraform/backend" - "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/internal/legacy/helper/acctest" ) func TestBackend_impl(t *testing.T) { diff --git a/backend/remote-state/azure/client_test.go b/backend/remote-state/azure/client_test.go index 45af094aa..c254e9ca1 100644 --- a/backend/remote-state/azure/client_test.go +++ b/backend/remote-state/azure/client_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hashicorp/terraform/backend" - "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/internal/legacy/helper/acctest" "github.com/hashicorp/terraform/states/remote" "github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs" ) diff --git a/command/clistate/state.go b/command/clistate/state.go index 2620c62f2..c04f7d70b 100644 --- a/command/clistate/state.go +++ b/command/clistate/state.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/errwrap" multierror "github.com/hashicorp/go-multierror" - "github.com/hashicorp/terraform/helper/slowmessage" + "github.com/hashicorp/terraform/internal/helper/slowmessage" "github.com/hashicorp/terraform/states/statemgr" "github.com/mitchellh/cli" "github.com/mitchellh/colorstring" diff --git a/command/console.go b/command/console.go index 09be505f6..bba816c3b 100644 --- a/command/console.go +++ b/command/console.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform/addrs" "github.com/hashicorp/terraform/backend" - "github.com/hashicorp/terraform/helper/wrappedstreams" + "github.com/hashicorp/terraform/internal/helper/wrappedstreams" "github.com/hashicorp/terraform/repl" "github.com/hashicorp/terraform/tfdiags" diff --git a/command/console_interactive.go b/command/console_interactive.go index f8261bb57..92f3b4efd 100644 --- a/command/console_interactive.go +++ b/command/console_interactive.go @@ -9,7 +9,7 @@ import ( "fmt" "io" - "github.com/hashicorp/terraform/helper/wrappedreadline" + "github.com/hashicorp/terraform/internal/helper/wrappedreadline" "github.com/hashicorp/terraform/repl" "github.com/chzyer/readline" diff --git a/helper/README.md b/helper/README.md deleted file mode 100644 index 2bcbe88e4..000000000 --- a/helper/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Legacy Helper Libraries - -The packages in this directory are all legacy code. Some of them are legacy -because they are now maintained in -[the Terraform SDK](https://github.com/hashicorp/terraform-plugin-sdk), -while others are just obsolete codepaths that we intend to migrate away -from over time. - -Avoid using functions from packages under `helper/` in new projects. diff --git a/helper/slowmessage/slowmessage.go b/internal/helper/slowmessage/slowmessage.go similarity index 100% rename from helper/slowmessage/slowmessage.go rename to internal/helper/slowmessage/slowmessage.go diff --git a/helper/slowmessage/slowmessage_test.go b/internal/helper/slowmessage/slowmessage_test.go similarity index 100% rename from helper/slowmessage/slowmessage_test.go rename to internal/helper/slowmessage/slowmessage_test.go diff --git a/helper/wrappedreadline/wrappedreadline.go b/internal/helper/wrappedreadline/wrappedreadline.go similarity index 96% rename from helper/wrappedreadline/wrappedreadline.go rename to internal/helper/wrappedreadline/wrappedreadline.go index 86d7b9215..6d2ffd15f 100644 --- a/helper/wrappedreadline/wrappedreadline.go +++ b/internal/helper/wrappedreadline/wrappedreadline.go @@ -14,7 +14,7 @@ import ( "github.com/chzyer/readline" - "github.com/hashicorp/terraform/helper/wrappedstreams" + "github.com/hashicorp/terraform/internal/helper/wrappedstreams" ) // Override overrides the values in readline.Config that need to be diff --git a/helper/wrappedreadline/wrappedreadline_unix.go b/internal/helper/wrappedreadline/wrappedreadline_unix.go similarity index 91% rename from helper/wrappedreadline/wrappedreadline_unix.go rename to internal/helper/wrappedreadline/wrappedreadline_unix.go index 4e410c7b7..00cf29320 100644 --- a/helper/wrappedreadline/wrappedreadline_unix.go +++ b/internal/helper/wrappedreadline/wrappedreadline_unix.go @@ -6,7 +6,7 @@ import ( "syscall" "unsafe" - "github.com/hashicorp/terraform/helper/wrappedstreams" + "github.com/hashicorp/terraform/internal/helper/wrappedstreams" ) // getWidth impl for Unix diff --git a/helper/wrappedreadline/wrappedreadline_windows.go b/internal/helper/wrappedreadline/wrappedreadline_windows.go similarity index 100% rename from helper/wrappedreadline/wrappedreadline_windows.go rename to internal/helper/wrappedreadline/wrappedreadline_windows.go diff --git a/helper/wrappedstreams/streams.go b/internal/helper/wrappedstreams/streams.go similarity index 100% rename from helper/wrappedstreams/streams.go rename to internal/helper/wrappedstreams/streams.go diff --git a/helper/wrappedstreams/streams_other.go b/internal/helper/wrappedstreams/streams_other.go similarity index 100% rename from helper/wrappedstreams/streams_other.go rename to internal/helper/wrappedstreams/streams_other.go diff --git a/helper/wrappedstreams/streams_windows.go b/internal/helper/wrappedstreams/streams_windows.go similarity index 100% rename from helper/wrappedstreams/streams_windows.go rename to internal/helper/wrappedstreams/streams_windows.go diff --git a/helper/acctest/acctest.go b/internal/legacy/helper/acctest/acctest.go similarity index 100% rename from helper/acctest/acctest.go rename to internal/legacy/helper/acctest/acctest.go diff --git a/helper/acctest/random.go b/internal/legacy/helper/acctest/random.go similarity index 100% rename from helper/acctest/random.go rename to internal/legacy/helper/acctest/random.go diff --git a/helper/acctest/random_test.go b/internal/legacy/helper/acctest/random_test.go similarity index 100% rename from helper/acctest/random_test.go rename to internal/legacy/helper/acctest/random_test.go diff --git a/helper/acctest/remotetests.go b/internal/legacy/helper/acctest/remotetests.go similarity index 100% rename from helper/acctest/remotetests.go rename to internal/legacy/helper/acctest/remotetests.go diff --git a/helper/hashcode/hashcode.go b/internal/legacy/helper/hashcode/hashcode.go similarity index 100% rename from helper/hashcode/hashcode.go rename to internal/legacy/helper/hashcode/hashcode.go diff --git a/helper/hashcode/hashcode_test.go b/internal/legacy/helper/hashcode/hashcode_test.go similarity index 100% rename from helper/hashcode/hashcode_test.go rename to internal/legacy/helper/hashcode/hashcode_test.go diff --git a/internal/legacy/helper/schema/field_reader_config_test.go b/internal/legacy/helper/schema/field_reader_config_test.go index bf09eaa6f..53b8e9077 100644 --- a/internal/legacy/helper/schema/field_reader_config_test.go +++ b/internal/legacy/helper/schema/field_reader_config_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/hashicorp/terraform/configs/hcl2shim" - "github.com/hashicorp/terraform/helper/hashcode" + "github.com/hashicorp/terraform/internal/legacy/helper/hashcode" "github.com/hashicorp/terraform/internal/legacy/terraform" ) diff --git a/internal/legacy/helper/schema/schema_test.go b/internal/legacy/helper/schema/schema_test.go index 262fcd46f..2a9da0f68 100644 --- a/internal/legacy/helper/schema/schema_test.go +++ b/internal/legacy/helper/schema/schema_test.go @@ -12,7 +12,7 @@ import ( "testing" "github.com/hashicorp/terraform/configs/hcl2shim" - "github.com/hashicorp/terraform/helper/hashcode" + "github.com/hashicorp/terraform/internal/legacy/helper/hashcode" "github.com/hashicorp/terraform/internal/legacy/terraform" ) diff --git a/internal/legacy/helper/schema/set.go b/internal/legacy/helper/schema/set.go index 8ee89e475..b44035c7c 100644 --- a/internal/legacy/helper/schema/set.go +++ b/internal/legacy/helper/schema/set.go @@ -8,7 +8,7 @@ import ( "strconv" "sync" - "github.com/hashicorp/terraform/helper/hashcode" + "github.com/hashicorp/terraform/internal/legacy/helper/hashcode" ) // HashString hashes strings. If you want a Set of strings, this is the diff --git a/internal/legacy/helper/schema/shims_test.go b/internal/legacy/helper/schema/shims_test.go index 3d0ee065d..90e616e63 100644 --- a/internal/legacy/helper/schema/shims_test.go +++ b/internal/legacy/helper/schema/shims_test.go @@ -13,7 +13,7 @@ import ( "github.com/google/go-cmp/cmp/cmpopts" "github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/configs/hcl2shim" - "github.com/hashicorp/terraform/helper/hashcode" + "github.com/hashicorp/terraform/internal/legacy/helper/hashcode" "github.com/hashicorp/terraform/internal/legacy/terraform" "github.com/hashicorp/terraform/providers" "github.com/hashicorp/terraform/tfdiags"