Skip to content

Commit 78b1220

Browse files
committed
Remove config.go and update things using its aliases
1 parent 37d16b2 commit 78b1220

5 files changed

Lines changed: 11 additions & 44 deletions

File tree

‎checkpoint.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77

88
"github.com/hashicorp/go-checkpoint"
99
"github.com/hashicorp/terraform/command"
10+
"github.com/hashicorp/terraform/command/cliconfig"
1011
)
1112

1213
func init() {
@@ -17,15 +18,15 @@ var checkpointResult chan *checkpoint.CheckResponse
1718

1819
// runCheckpoint runs a HashiCorp Checkpoint request. You can read about
1920
// Checkpoint here: https://github.com/hashicorp/go-checkpoint.
20-
func runCheckpoint(c *Config) {
21+
func runCheckpoint(c *cliconfig.Config) {
2122
// If the user doesn't want checkpoint at all, then return.
2223
if c.DisableCheckpoint {
2324
log.Printf("[INFO] Checkpoint disabled. Not running.")
2425
checkpointResult <- nil
2526
return
2627
}
2728

28-
configDir, err := ConfigDir()
29+
configDir, err := cliconfig.ConfigDir()
2930
if err != nil {
3031
log.Printf("[ERR] Checkpoint setup error: %s", err)
3132
checkpointResult <- nil

‎commands.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
"github.com/mitchellh/cli"
88

9-
"github.com/hashicorp/terraform-svchost"
9+
svchost "github.com/hashicorp/terraform-svchost"
1010
"github.com/hashicorp/terraform-svchost/auth"
1111
"github.com/hashicorp/terraform-svchost/disco"
1212
"github.com/hashicorp/terraform/command"
@@ -37,7 +37,7 @@ const (
3737
OutputPrefix = "o:"
3838
)
3939

40-
func initCommands(config *Config, services *disco.Disco) {
40+
func initCommands(config *cliconfig.Config, services *disco.Disco) {
4141
var inAutomation bool
4242
if v := os.Getenv(runningInAutomationEnvName); v != "" {
4343
inAutomation = true
@@ -390,7 +390,7 @@ func makeShutdownCh() <-chan struct{} {
390390
return resultCh
391391
}
392392

393-
func credentialsSource(config *Config) (auth.CredentialsSource, error) {
393+
func credentialsSource(config *cliconfig.Config) (auth.CredentialsSource, error) {
394394
helperPlugins := pluginDiscovery.FindPlugins("credentials", globalPluginDirs())
395395
return config.CredentialsSource(helperPlugins)
396396
}

‎config.go‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎main.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
"github.com/hashicorp/go-plugin"
1515
"github.com/hashicorp/terraform-svchost/disco"
16+
"github.com/hashicorp/terraform/command/cliconfig"
1617
"github.com/hashicorp/terraform/command/format"
1718
"github.com/hashicorp/terraform/helper/logging"
1819
"github.com/hashicorp/terraform/httpclient"
@@ -125,7 +126,7 @@ func wrappedMain() int {
125126
log.Printf("[INFO] Go runtime version: %s", runtime.Version())
126127
log.Printf("[INFO] CLI args: %#v", os.Args)
127128

128-
config, diags := LoadConfig()
129+
config, diags := cliconfig.LoadConfig()
129130
if len(diags) > 0 {
130131
// Since we haven't instantiated a command.Meta yet, we need to do
131132
// some things manually here and use some "safe" defaults for things

‎plugins.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"log"
66
"path/filepath"
77
"runtime"
8+
9+
"github.com/hashicorp/terraform/command/cliconfig"
810
)
911

1012
// globalPluginDirs returns directories that should be searched for
@@ -16,7 +18,7 @@ import (
1618
func globalPluginDirs() []string {
1719
var ret []string
1820
// Look in ~/.terraform.d/plugins/ , or its equivalent on non-UNIX
19-
dir, err := ConfigDir()
21+
dir, err := cliconfig.ConfigDir()
2022
if err != nil {
2123
log.Printf("[ERROR] Error finding global config directory: %s", err)
2224
} else {

0 commit comments

Comments
 (0)