command: go fmt

This commit is contained in:
Martin Atkins 2018-10-14 07:59:15 -07:00
parent 53bb3f57e6
commit 73318a436b
7 changed files with 32 additions and 33 deletions

View File

@ -227,7 +227,7 @@ func TestApply_destroyTargeted(t *testing.T) {
}, },
}, },
} }
p.PlanResourceChangeFn = func (req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse { p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
return providers.PlanResourceChangeResponse{ return providers.PlanResourceChangeResponse{
PlannedState: req.ProposedNewState, PlannedState: req.ProposedNewState,
} }

View File

@ -182,15 +182,15 @@ func TestApply_parallelism(t *testing.T) {
provider := &terraform.MockProvider{} provider := &terraform.MockProvider{}
provider.GetSchemaReturn = &terraform.ProviderSchema{ provider.GetSchemaReturn = &terraform.ProviderSchema{
ResourceTypes: map[string]*configschema.Block{ ResourceTypes: map[string]*configschema.Block{
name+"_instance": {}, name + "_instance": {},
}, },
} }
provider.PlanResourceChangeFn = func (req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse { provider.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
return providers.PlanResourceChangeResponse{ return providers.PlanResourceChangeResponse{
PlannedState: req.ProposedNewState, PlannedState: req.ProposedNewState,
} }
} }
provider.ApplyResourceChangeFn = func (req providers.ApplyResourceChangeRequest) providers.ApplyResourceChangeResponse { provider.ApplyResourceChangeFn = func(req providers.ApplyResourceChangeRequest) providers.ApplyResourceChangeResponse {
// Increment so we're counting parallelism // Increment so we're counting parallelism
started <- 1 started <- 1
runCount.Inc() runCount.Inc()
@ -1111,7 +1111,7 @@ func TestApply_vars(t *testing.T) {
}, },
}, },
} }
p.ApplyResourceChangeFn = func (req providers.ApplyResourceChangeRequest) providers.ApplyResourceChangeResponse { p.ApplyResourceChangeFn = func(req providers.ApplyResourceChangeRequest) providers.ApplyResourceChangeResponse {
return providers.ApplyResourceChangeResponse{ return providers.ApplyResourceChangeResponse{
NewState: req.PlannedState, NewState: req.PlannedState,
} }
@ -1170,7 +1170,7 @@ func TestApply_varFile(t *testing.T) {
}, },
}, },
} }
p.ApplyResourceChangeFn = func (req providers.ApplyResourceChangeRequest) providers.ApplyResourceChangeResponse { p.ApplyResourceChangeFn = func(req providers.ApplyResourceChangeRequest) providers.ApplyResourceChangeResponse {
return providers.ApplyResourceChangeResponse{ return providers.ApplyResourceChangeResponse{
NewState: req.PlannedState, NewState: req.PlannedState,
} }
@ -1239,7 +1239,7 @@ func TestApply_varFileDefault(t *testing.T) {
}, },
}, },
} }
p.ApplyResourceChangeFn = func (req providers.ApplyResourceChangeRequest) providers.ApplyResourceChangeResponse { p.ApplyResourceChangeFn = func(req providers.ApplyResourceChangeRequest) providers.ApplyResourceChangeResponse {
return providers.ApplyResourceChangeResponse{ return providers.ApplyResourceChangeResponse{
NewState: req.PlannedState, NewState: req.PlannedState,
} }
@ -1307,7 +1307,7 @@ func TestApply_varFileDefaultJSON(t *testing.T) {
}, },
}, },
} }
p.ApplyResourceChangeFn = func (req providers.ApplyResourceChangeRequest) providers.ApplyResourceChangeResponse { p.ApplyResourceChangeFn = func(req providers.ApplyResourceChangeRequest) providers.ApplyResourceChangeResponse {
return providers.ApplyResourceChangeResponse{ return providers.ApplyResourceChangeResponse{
NewState: req.PlannedState, NewState: req.PlannedState,
} }
@ -1400,7 +1400,7 @@ func TestApply_backup(t *testing.T) {
if !cmp.Equal(actual, expected) { if !cmp.Equal(actual, expected) {
t.Fatalf( t.Fatalf(
"wrong aws_instance.foo state\n%s", "wrong aws_instance.foo state\n%s",
cmp.Diff(expected, actual, cmp.Transformer("bytesAsString", func (b []byte) string { cmp.Diff(expected, actual, cmp.Transformer("bytesAsString", func(b []byte) string {
return string(b) return string(b)
})), })),
) )
@ -1449,7 +1449,7 @@ func TestApply_disableBackup(t *testing.T) {
actual = p.ApplyResourceChangeRequest.PriorState actual = p.ApplyResourceChangeRequest.PriorState
expected = cty.ObjectVal(map[string]cty.Value{ expected = cty.ObjectVal(map[string]cty.Value{
"id": cty.StringVal("bar"), "id": cty.StringVal("bar"),
"ami": cty.NullVal(cty.String), "ami": cty.NullVal(cty.String),
}) })
if !expected.RawEquals(actual) { if !expected.RawEquals(actual) {
@ -1599,7 +1599,7 @@ func applyFixtureSchema() *terraform.ProviderSchema {
ResourceTypes: map[string]*configschema.Block{ ResourceTypes: map[string]*configschema.Block{
"test_instance": { "test_instance": {
Attributes: map[string]*configschema.Attribute{ Attributes: map[string]*configschema.Attribute{
"id": {Type: cty.String, Optional: true, Computed: true}, "id": {Type: cty.String, Optional: true, Computed: true},
"ami": {Type: cty.String, Optional: true}, "ami": {Type: cty.String, Optional: true},
}, },
}, },
@ -1615,12 +1615,12 @@ func applyFixtureSchema() *terraform.ProviderSchema {
func applyFixtureProvider() *terraform.MockProvider { func applyFixtureProvider() *terraform.MockProvider {
p := testProvider() p := testProvider()
p.GetSchemaReturn = applyFixtureSchema() p.GetSchemaReturn = applyFixtureSchema()
p.PlanResourceChangeFn = func (req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse { p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
return providers.PlanResourceChangeResponse{ return providers.PlanResourceChangeResponse{
PlannedState: req.ProposedNewState, PlannedState: req.ProposedNewState,
} }
} }
p.ApplyResourceChangeFn = func (req providers.ApplyResourceChangeRequest) providers.ApplyResourceChangeResponse { p.ApplyResourceChangeFn = func(req providers.ApplyResourceChangeRequest) providers.ApplyResourceChangeResponse {
return providers.ApplyResourceChangeResponse{ return providers.ApplyResourceChangeResponse{
NewState: cty.UnknownAsNull(req.PlannedState), NewState: cty.UnknownAsNull(req.PlannedState),
} }

View File

@ -158,13 +158,13 @@ func (h *UiHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation,
key := addr.String() key := addr.String()
uiState := uiResourceState{ uiState := uiResourceState{
DispAddr: key, DispAddr: key,
IDKey: idKey, IDKey: idKey,
IDValue: idValue, IDValue: idValue,
Op: op, Op: op,
Start: time.Now().Round(time.Second), Start: time.Now().Round(time.Second),
DoneCh: make(chan struct{}), DoneCh: make(chan struct{}),
done: make(chan struct{}), done: make(chan struct{}),
} }
h.l.Lock() h.l.Lock()

View File

@ -38,7 +38,7 @@ func TestImport(t *testing.T) {
ImportedResources: []providers.ImportedResource{ ImportedResources: []providers.ImportedResource{
{ {
TypeName: "test_instance", TypeName: "test_instance",
State: cty.ObjectVal(map[string]cty.Value{ State: cty.ObjectVal(map[string]cty.Value{
"id": cty.StringVal("yay"), "id": cty.StringVal("yay"),
}), }),
}, },
@ -80,7 +80,7 @@ func TestImport_providerConfig(t *testing.T) {
ImportedResources: []providers.ImportedResource{ ImportedResources: []providers.ImportedResource{
{ {
TypeName: "test_instance", TypeName: "test_instance",
State: cty.ObjectVal(map[string]cty.Value{ State: cty.ObjectVal(map[string]cty.Value{
"id": cty.StringVal("yay"), "id": cty.StringVal("yay"),
}), }),
}, },
@ -172,7 +172,7 @@ func TestImport_remoteState(t *testing.T) {
ImportedResources: []providers.ImportedResource{ ImportedResources: []providers.ImportedResource{
{ {
TypeName: "test_instance", TypeName: "test_instance",
State: cty.ObjectVal(map[string]cty.Value{ State: cty.ObjectVal(map[string]cty.Value{
"id": cty.StringVal("yay"), "id": cty.StringVal("yay"),
}), }),
}, },
@ -236,7 +236,7 @@ func TestImport_providerConfigWithVar(t *testing.T) {
ImportedResources: []providers.ImportedResource{ ImportedResources: []providers.ImportedResource{
{ {
TypeName: "test_instance", TypeName: "test_instance",
State: cty.ObjectVal(map[string]cty.Value{ State: cty.ObjectVal(map[string]cty.Value{
"id": cty.StringVal("yay"), "id": cty.StringVal("yay"),
}), }),
}, },
@ -295,7 +295,7 @@ func TestImport_providerConfigWithVarDefault(t *testing.T) {
ImportedResources: []providers.ImportedResource{ ImportedResources: []providers.ImportedResource{
{ {
TypeName: "test_instance", TypeName: "test_instance",
State: cty.ObjectVal(map[string]cty.Value{ State: cty.ObjectVal(map[string]cty.Value{
"id": cty.StringVal("yay"), "id": cty.StringVal("yay"),
}), }),
}, },
@ -353,7 +353,7 @@ func TestImport_providerConfigWithVarFile(t *testing.T) {
ImportedResources: []providers.ImportedResource{ ImportedResources: []providers.ImportedResource{
{ {
TypeName: "test_instance", TypeName: "test_instance",
State: cty.ObjectVal(map[string]cty.Value{ State: cty.ObjectVal(map[string]cty.Value{
"id": cty.StringVal("yay"), "id": cty.StringVal("yay"),
}), }),
}, },
@ -412,7 +412,7 @@ func TestImport_customProvider(t *testing.T) {
ImportedResources: []providers.ImportedResource{ ImportedResources: []providers.ImportedResource{
{ {
TypeName: "test_instance", TypeName: "test_instance",
State: cty.ObjectVal(map[string]cty.Value{ State: cty.ObjectVal(map[string]cty.Value{
"id": cty.StringVal("yay"), "id": cty.StringVal("yay"),
}), }),
}, },
@ -455,7 +455,7 @@ func TestImport_allowMissingResourceConfig(t *testing.T) {
ImportedResources: []providers.ImportedResource{ ImportedResources: []providers.ImportedResource{
{ {
TypeName: "test_instance", TypeName: "test_instance",
State: cty.ObjectVal(map[string]cty.Value{ State: cty.ObjectVal(map[string]cty.Value{
"id": cty.StringVal("yay"), "id": cty.StringVal("yay"),
}), }),
}, },

View File

@ -9,9 +9,9 @@ import (
"github.com/hashicorp/hcl2/hcl/hclsyntax" "github.com/hashicorp/hcl2/hcl/hclsyntax"
"github.com/hashicorp/hcl2/hcl" "github.com/hashicorp/hcl2/hcl"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/configs" "github.com/hashicorp/terraform/configs"
"github.com/hashicorp/terraform/configs/configload" "github.com/hashicorp/terraform/configs/configload"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
"github.com/hashicorp/terraform/tfdiags" "github.com/hashicorp/terraform/tfdiags"
"github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty"

View File

@ -114,7 +114,6 @@ func (m *Meta) collectVariableValues() (map[string]backend.UnparsedVariableValue
return ret, diags return ret, diags
} }
func (m *Meta) addVarsFromFile(filename string, sourceType terraform.ValueSourceType, to map[string]backend.UnparsedVariableValue) tfdiags.Diagnostics { func (m *Meta) addVarsFromFile(filename string, sourceType terraform.ValueSourceType, to map[string]backend.UnparsedVariableValue) tfdiags.Diagnostics {
var diags tfdiags.Diagnostics var diags tfdiags.Diagnostics
@ -213,7 +212,7 @@ func (v unparsedVariableValueString) ParseVariableValue(mode configs.VariablePar
diags = diags.Append(hclDiags) diags = diags.Append(hclDiags)
return &terraform.InputValue{ return &terraform.InputValue{
Value: val, Value: val,
SourceType: v.sourceType, SourceType: v.sourceType,
}, diags }, diags
} }

View File

@ -9,8 +9,8 @@ import (
"github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty"
"github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/terraform"
"github.com/hashicorp/terraform/helper/copy" "github.com/hashicorp/terraform/helper/copy"
"github.com/hashicorp/terraform/terraform"
) )
func setupTest(fixturepath string, args ...string) (*cli.MockUi, int) { func setupTest(fixturepath string, args ...string) (*cli.MockUi, int) {