Merge pull request #9436 from hashicorp/jbardin/vet

Fix vet issues
This commit is contained in:
James Bardin 2016-10-18 11:31:34 -04:00 committed by GitHub
commit 46185981a2
5 changed files with 17 additions and 13 deletions

View File

@ -65,7 +65,7 @@ func testAccVhostCheckDestroy(name string) resource.TestCheckFunc {
for _, vhost := range vhosts {
if vhost.Name == name {
return fmt.Errorf("vhost still exists: %s", vhost)
return fmt.Errorf("vhost still exists: %v", vhost)
}
}

View File

@ -131,7 +131,7 @@ func (c *InitCommand) Run(args []string) int {
// Initialize a blank state file with remote enabled
remoteCmd := &RemoteConfigCommand{
Meta: c.Meta,
remoteConf: remoteConf,
remoteConf: &remoteConf,
}
return remoteCmd.initBlankState()
}

View File

@ -763,12 +763,12 @@ func testArchiveStr(t *testing.T, path string) []string {
func pushTFVars() []atlas.TFVar {
return []atlas.TFVar{
{"bar", "foo", false},
{"baz", `{
{Key: "bar", Value: "foo", IsHCL: false},
{Key: "baz", Value: `{
A = "a"
}`, true},
{"fob", `["a", "quotes \"in\" quotes"]`, true},
{"foo", "bar", false},
}`, IsHCL: true},
{Key: "fob", Value: `["a", "quotes \"in\" quotes"]`, IsHCL: true},
{Key: "foo", Value: "bar", IsHCL: false},
}
}

View File

@ -26,10 +26,15 @@ type remoteCommandConfig struct {
type RemoteConfigCommand struct {
Meta
conf remoteCommandConfig
remoteConf terraform.RemoteState
remoteConf *terraform.RemoteState
}
func (c *RemoteConfigCommand) Run(args []string) int {
// we expect a zero struct value here, but it's not explicitly set in tests
if c.remoteConf == nil {
c.remoteConf = &terraform.RemoteState{}
}
args = c.Meta.process(args, false)
config := make(map[string]string)
cmdFlags := flag.NewFlagSet("remote", flag.ContinueOnError)
@ -229,7 +234,7 @@ func (c *RemoteConfigCommand) initBlankState() int {
// Make a blank state, attach the remote configuration
blank := terraform.NewState()
blank.Remote = &c.remoteConf
blank.Remote = c.remoteConf
// Persist the state
remote := &state.LocalState{Path: c.stateResult.RemotePath}
@ -260,7 +265,7 @@ func (c *RemoteConfigCommand) updateRemoteConfig() int {
// Update the configuration
state := remote.State()
state.Remote = &c.remoteConf
state.Remote = c.remoteConf
if err := remote.WriteState(state); err != nil {
c.Ui.Error(fmt.Sprintf("%s", err))
return 1
@ -312,7 +317,7 @@ func (c *RemoteConfigCommand) enableRemoteState() int {
// Update the local configuration, move into place
state := local.State()
state.Remote = &c.remoteConf
state.Remote = c.remoteConf
remote := c.stateResult.Remote
if err := remote.WriteState(state); err != nil {
c.Ui.Error(fmt.Sprintf("%s", err))

View File

@ -92,8 +92,7 @@ func TestState(t *testing.T, s interface{}) {
}
// Change the serial
currentCopy := *current
current = &currentCopy
current = current.DeepCopy()
current.Modules = []*terraform.ModuleState{
&terraform.ModuleState{
Path: []string{"root", "somewhere"},