Fix vet issues

None were critical, but these will fail with the next version of vet.
This commit is contained in:
James Bardin 2016-10-18 11:11:12 -04:00
parent 1df6c4d5c0
commit f175497dd7
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 { for _, vhost := range vhosts {
if vhost.Name == name { 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 // Initialize a blank state file with remote enabled
remoteCmd := &RemoteConfigCommand{ remoteCmd := &RemoteConfigCommand{
Meta: c.Meta, Meta: c.Meta,
remoteConf: remoteConf, remoteConf: &remoteConf,
} }
return remoteCmd.initBlankState() return remoteCmd.initBlankState()
} }

View File

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

View File

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

View File

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