diff --git a/builder/amazonebs/builder.go b/builder/amazonebs/builder.go index d20bf4781..95fc55805 100644 --- a/builder/amazonebs/builder.go +++ b/builder/amazonebs/builder.go @@ -54,10 +54,10 @@ func (b *Builder) Run(build packer.Build, ui packer.Ui) { ec2conn := ec2.New(auth, region) runOpts := &ec2.RunInstances{ - ImageId: b.config.SourceAmi, + ImageId: b.config.SourceAmi, InstanceType: "m1.small", - MinCount: 0, - MaxCount: 0, + MinCount: 0, + MaxCount: 0, } ui.Say("Launching a source AWS instance...\n") @@ -97,7 +97,7 @@ func (b *Builder) Run(build packer.Build, ui packer.Ui) { ui.Say("Creating the AMI...\n") createOpts := &ec2.CreateImage{ InstanceId: instance.InstanceId, - Name: b.config.AMIName, + Name: b.config.AMIName, } createResp, err := ec2conn.CreateImage(createOpts) diff --git a/builder/amazonebs/builder_test.go b/builder/amazonebs/builder_test.go index 6c2fb1ac6..c54a352f3 100644 --- a/builder/amazonebs/builder_test.go +++ b/builder/amazonebs/builder_test.go @@ -17,7 +17,7 @@ func TestBuilder_Prepare_BadType(t *testing.T) { assert := asserts.NewTestingAsserts(t, true) b := &Builder{} - c := map[string]interface{} { + c := map[string]interface{}{ "access_key": []string{}, } @@ -29,7 +29,7 @@ func TestBuilder_Prepare_Good(t *testing.T) { assert := asserts.NewTestingAsserts(t, true) b := &Builder{} - c := map[string]interface{} { + c := map[string]interface{}{ "access_key": "foo", "secret_key": "bar", "source_ami": "123456", diff --git a/command/build/command_test.go b/command/build/command_test.go index c5230340a..116f6eb42 100644 --- a/command/build/command_test.go +++ b/command/build/command_test.go @@ -1,6 +1,5 @@ package build - import ( "bytes" "cgl.tideland.biz/asserts" diff --git a/packer.go b/packer.go index b3041eba8..ce2936100 100644 --- a/packer.go +++ b/packer.go @@ -2,9 +2,9 @@ package main import ( + "fmt" "github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer/plugin" - "fmt" "io/ioutil" "log" "os" diff --git a/packer/build.go b/packer/build.go index 159b765dd..a2c455ee2 100644 --- a/packer/build.go +++ b/packer/build.go @@ -15,8 +15,8 @@ type Build interface { // multiple files, of course, but it should be for only a single provider // (such as VirtualBox, EC2, etc.). type coreBuild struct { - name string - builder Builder + name string + builder Builder rawConfig interface{} prepareCalled bool diff --git a/packer/build_test.go b/packer/build_test.go index d26edfcc4..e156d8418 100644 --- a/packer/build_test.go +++ b/packer/build_test.go @@ -8,9 +8,9 @@ import ( type TestBuilder struct { prepareCalled bool prepareConfig interface{} - runCalled bool - runBuild Build - runUi Ui + runCalled bool + runBuild Build + runUi Ui } func (tb *TestBuilder) Prepare(config interface{}) error { @@ -27,8 +27,8 @@ func (tb *TestBuilder) Run(b Build, ui Ui) { func testBuild() Build { return &coreBuild{ - name: "test", - builder: &TestBuilder{}, + name: "test", + builder: &TestBuilder{}, rawConfig: 42, } } diff --git a/packer/builder.go b/packer/builder.go index 7ff1bb95b..55ea5bff0 100644 --- a/packer/builder.go +++ b/packer/builder.go @@ -13,4 +13,3 @@ type Builder interface { Prepare(config interface{}) error Run(build Build, ui Ui) } - diff --git a/packer/command_test.go b/packer/command_test.go index 904ef2657..163c3803a 100644 --- a/packer/command_test.go +++ b/packer/command_test.go @@ -1,9 +1,9 @@ package packer type TestCommand struct { - runArgs []string + runArgs []string runCalled bool - runEnv Environment + runEnv Environment } func (tc *TestCommand) Run(env Environment, args []string) int { diff --git a/packer/environment.go b/packer/environment.go index 2e15562e1..3917743bc 100644 --- a/packer/environment.go +++ b/packer/environment.go @@ -31,17 +31,17 @@ type Environment interface { // environment. type coreEnvironment struct { builderFunc BuilderFunc - commands []string + commands []string commandFunc CommandFunc - ui Ui + ui Ui } // This struct configures new environments. type EnvironmentConfig struct { BuilderFunc BuilderFunc CommandFunc CommandFunc - Commands []string - Ui Ui + Commands []string + Ui Ui } // DefaultEnvironmentConfig returns a default EnvironmentConfig that can diff --git a/packer/plugin/builder.go b/packer/plugin/builder.go index 70166ff0e..ababcdc92 100644 --- a/packer/plugin/builder.go +++ b/packer/plugin/builder.go @@ -2,15 +2,15 @@ package plugin import ( "github.com/mitchellh/packer/packer" + packrpc "github.com/mitchellh/packer/packer/rpc" "log" "net/rpc" "os/exec" - packrpc "github.com/mitchellh/packer/packer/rpc" ) type cmdBuilder struct { builder packer.Builder - client *client + client *client } func (b *cmdBuilder) Prepare(config interface{}) error { @@ -39,7 +39,6 @@ func (c *cmdBuilder) checkExit(p interface{}, cb func()) { } } - // Returns a valid packer.Builder where the builder is executed via RPC // to a plugin that is within a subprocess. // diff --git a/packer/plugin/builder_test.go b/packer/plugin/builder_test.go index fdb1f61b5..e883bd02d 100644 --- a/packer/plugin/builder_test.go +++ b/packer/plugin/builder_test.go @@ -28,4 +28,3 @@ func TestBuilder_Good(t *testing.T) { _, err := Builder(helperProcess("builder")) assert.Nil(err, "should start builder properly") } - diff --git a/packer/plugin/client.go b/packer/plugin/client.go index efdf3e627..7aa63859c 100644 --- a/packer/plugin/client.go +++ b/packer/plugin/client.go @@ -16,8 +16,8 @@ import ( var managedClients = make([]*client, 0, 5) type client struct { - cmd *exec.Cmd - exited bool + cmd *exec.Cmd + exited bool doneLogging bool } diff --git a/packer/plugin/command.go b/packer/plugin/command.go index 9b98c87f0..19c0996ba 100644 --- a/packer/plugin/command.go +++ b/packer/plugin/command.go @@ -2,15 +2,15 @@ package plugin import ( "github.com/mitchellh/packer/packer" + packrpc "github.com/mitchellh/packer/packer/rpc" "log" "net/rpc" "os/exec" - packrpc "github.com/mitchellh/packer/packer/rpc" ) type cmdCommand struct { command packer.Command - client *client + client *client } func (c *cmdCommand) Run(e packer.Environment, args []string) (exitCode int) { diff --git a/packer/plugin/plugin.go b/packer/plugin/plugin.go index 7f9b58a32..175f62bed 100644 --- a/packer/plugin/plugin.go +++ b/packer/plugin/plugin.go @@ -10,11 +10,11 @@ package plugin import ( "fmt" "github.com/mitchellh/packer/packer" + packrpc "github.com/mitchellh/packer/packer/rpc" "log" "net" "net/rpc" "os" - packrpc "github.com/mitchellh/packer/packer/rpc" "strconv" "strings" ) diff --git a/packer/plugin/plugin_test.go b/packer/plugin/plugin_test.go index 3a1a999b8..30dbeec5c 100644 --- a/packer/plugin/plugin_test.go +++ b/packer/plugin/plugin_test.go @@ -8,7 +8,7 @@ import ( "time" ) -func helperProcess(s... string) *exec.Cmd { +func helperProcess(s ...string) *exec.Cmd { cs := []string{"-test.run=TestHelperProcess", "--"} cs = append(cs, s...) env := []string{ diff --git a/packer/rpc/build.go b/packer/rpc/build.go index 73930a4fa..9256610d3 100644 --- a/packer/rpc/build.go +++ b/packer/rpc/build.go @@ -42,7 +42,7 @@ func (b *Build) Run(ui packer.Ui) { b.client.Call("Build.Run", args, new(interface{})) } -func (b *BuildServer) Name(args *interface{}, reply*string) error { +func (b *BuildServer) Name(args *interface{}, reply *string) error { *reply = b.build.Name() return nil } diff --git a/packer/rpc/build_test.go b/packer/rpc/build_test.go index 3720f128b..4b3b6d396 100644 --- a/packer/rpc/build_test.go +++ b/packer/rpc/build_test.go @@ -8,10 +8,10 @@ import ( ) type testBuild struct { - nameCalled bool + nameCalled bool prepareCalled bool - runCalled bool - runUi packer.Ui + runCalled bool + runUi packer.Ui } func (b *testBuild) Name() string { diff --git a/packer/rpc/builder_test.go b/packer/rpc/builder_test.go index 030b85513..82980961d 100644 --- a/packer/rpc/builder_test.go +++ b/packer/rpc/builder_test.go @@ -10,9 +10,9 @@ import ( type testBuilder struct { prepareCalled bool prepareConfig interface{} - runCalled bool - runBuild packer.Build - runUi packer.Ui + runCalled bool + runBuild packer.Build + runUi packer.Ui } func (b *testBuilder) Prepare(config interface{}) error { diff --git a/packer/rpc/command.go b/packer/rpc/command.go index d19e22486..b754579f9 100644 --- a/packer/rpc/command.go +++ b/packer/rpc/command.go @@ -19,7 +19,7 @@ type CommandServer struct { type CommandRunArgs struct { RPCAddress string - Args []string + Args []string } type CommandSynopsisArgs byte diff --git a/packer/rpc/command_test.go b/packer/rpc/command_test.go index da7fad2d6..f61ca6188 100644 --- a/packer/rpc/command_test.go +++ b/packer/rpc/command_test.go @@ -8,9 +8,9 @@ import ( ) type TestCommand struct { - runArgs []string + runArgs []string runCalled bool - runEnv packer.Environment + runEnv packer.Environment } func (tc *TestCommand) Run(env packer.Environment, args []string) int { diff --git a/packer/rpc/environment_test.go b/packer/rpc/environment_test.go index 33810d6fe..7fd294dd7 100644 --- a/packer/rpc/environment_test.go +++ b/packer/rpc/environment_test.go @@ -12,10 +12,10 @@ var testEnvUi = &testUi{} type testEnvironment struct { builderCalled bool - builderName string - cliCalled bool - cliArgs []string - uiCalled bool + builderName string + cliCalled bool + cliArgs []string + uiCalled bool } func (e *testEnvironment) Builder(name string) (packer.Builder, error) { diff --git a/packer/rpc/port_test.go b/packer/rpc/port_test.go index 0c889f432..9c98ba5bb 100644 --- a/packer/rpc/port_test.go +++ b/packer/rpc/port_test.go @@ -9,7 +9,7 @@ import ( func addrPort(address net.Addr) string { parts := strings.Split(address.String(), ":") - return parts[len(parts) - 1] + return parts[len(parts)-1] } func Test_netListenerInRange(t *testing.T) { diff --git a/packer/rpc/server_test.go b/packer/rpc/server_test.go index 300b3513d..9ab1e3e8e 100644 --- a/packer/rpc/server_test.go +++ b/packer/rpc/server_test.go @@ -1,2 +1 @@ package rpc - diff --git a/packer/rpc/ui.go b/packer/rpc/ui.go index 710428057..9d564f533 100644 --- a/packer/rpc/ui.go +++ b/packer/rpc/ui.go @@ -19,7 +19,7 @@ type UiServer struct { type UiSayArgs struct { Format string - Vars []interface{} + Vars []interface{} } func (u *Ui) Error(format string, a ...interface{}) { diff --git a/packer/rpc/ui_test.go b/packer/rpc/ui_test.go index d15568dbf..bec8a4adc 100644 --- a/packer/rpc/ui_test.go +++ b/packer/rpc/ui_test.go @@ -9,10 +9,10 @@ import ( type testUi struct { errorCalled bool errorFormat string - errorVars []interface{} - sayCalled bool - sayFormat string - sayVars []interface{} + errorVars []interface{} + sayCalled bool + sayFormat string + sayVars []interface{} } func (u *testUi) Error(format string, a ...interface{}) { diff --git a/packer/template.go b/packer/template.go index 23daecfc7..3312259e3 100644 --- a/packer/template.go +++ b/packer/template.go @@ -111,8 +111,8 @@ func (t *Template) Build(name string, bf BuilderFunc) (b Build, err error) { } b = &coreBuild{ - name: name, - builder: builder, + name: name, + builder: builder, rawConfig: builderConfig.rawConfig, } diff --git a/packer/template_test.go b/packer/template_test.go index c7ac02686..bd0e708b3 100644 --- a/packer/template_test.go +++ b/packer/template_test.go @@ -178,7 +178,7 @@ func TestTemplate_Build(t *testing.T) { } ` - expectedConfig := map[string]interface{} { + expectedConfig := map[string]interface{}{ "name": "test1", "type": "test-builder", } @@ -187,7 +187,7 @@ func TestTemplate_Build(t *testing.T) { assert.Nil(err, "should not error") builder := testBuilder() - builderMap := map[string]Builder { + builderMap := map[string]Builder{ "test-builder": builder, } diff --git a/packer/ui.go b/packer/ui.go index 6a735ee39..a208e4d18 100644 --- a/packer/ui.go +++ b/packer/ui.go @@ -8,7 +8,7 @@ import "io" // is formatted and various levels of output. type Ui interface { Say(format string, a ...interface{}) - Error(format string, a...interface{}) + Error(format string, a ...interface{}) } // The ReaderWriterUi is a UI that writes and reads from standard Go