apply gofmt

This commit is contained in:
Michael Kuzmin 2018-11-01 00:42:24 +03:00
parent 6bfb34e0ab
commit a3f0f15ffd
35 changed files with 124 additions and 129 deletions

View File

@ -2,11 +2,11 @@ package clone
import ( import (
packerCommon "github.com/hashicorp/packer/common" packerCommon "github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/helper/communicator"
) )
type Builder struct { type Builder struct {

View File

@ -2,12 +2,11 @@ package clone
import ( import (
builderT "github.com/hashicorp/packer/helper/builder/testing" builderT "github.com/hashicorp/packer/helper/builder/testing"
"github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/common"
commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing"
"os" "os"
"github.com/hashicorp/packer/packer"
"testing" "testing"
"github.com/jetbrains-infra/packer-builder-vsphere/common"
) )
func TestCloneBuilderAcc_default(t *testing.T) { func TestCloneBuilderAcc_default(t *testing.T) {

View File

@ -3,10 +3,10 @@ package clone
import ( import (
packerCommon "github.com/hashicorp/packer/common" packerCommon "github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/config"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/template/interpolate" "github.com/hashicorp/packer/template/interpolate"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"github.com/hashicorp/packer/helper/config"
) )
type Config struct { type Config struct {

View File

@ -1,12 +1,12 @@
package clone package clone
import ( import (
"context"
"fmt"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"fmt"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"context" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
) )
type CloneConfig struct { type CloneConfig struct {

View File

@ -2,12 +2,11 @@ package common
import ( import (
"fmt" "fmt"
"io/ioutil"
packerssh "github.com/hashicorp/packer/communicator/ssh" packerssh "github.com/hashicorp/packer/communicator/ssh"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
"github.com/hashicorp/packer/helper/communicator" "io/ioutil"
) )
func CommHost(state multistep.StateBag) (string, error) { func CommHost(state multistep.StateBag) (string, error) {

View File

@ -1,11 +1,11 @@
package common package common
import ( import (
"context"
"fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"fmt"
"context"
) )
type ConfigParamsConfig struct { type ConfigParamsConfig struct {

View File

@ -1,10 +1,10 @@
package common package common
import ( import (
"github.com/hashicorp/packer/helper/multistep"
"fmt"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"context" "context"
"fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
) )
type ConnectConfig struct { type ConnectConfig struct {

View File

@ -1,11 +1,11 @@
package common package common
import ( import (
"github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"context" "context"
"fmt" "fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
) )
type HardwareConfig struct { type HardwareConfig struct {

View File

@ -1,11 +1,11 @@
package common package common
import ( import (
"context"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"strings" "strings"
"context"
) )
type RunConfig struct { type RunConfig struct {

View File

@ -1,14 +1,14 @@
package common package common
import ( import (
"bytes"
"context"
"fmt"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"log" "log"
"time" "time"
"bytes"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"context"
) )
type ShutdownConfig struct { type ShutdownConfig struct {

View File

@ -1,10 +1,10 @@
package common package common
import ( import (
"context"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"context"
) )
type StepCreateSnapshot struct { type StepCreateSnapshot struct {

View File

@ -1,10 +1,10 @@
package common package common
import ( import (
"context"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"context"
) )
type StepConvertToTemplate struct { type StepConvertToTemplate struct {

View File

@ -1,12 +1,12 @@
package common package common
import ( import (
"github.com/hashicorp/packer/helper/multistep" "context"
"fmt" "fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"time" "time"
"context"
) )
type StepWaitForIp struct{} type StepWaitForIp struct{}

View File

@ -1,14 +1,14 @@
package testing package testing
import ( import (
"fmt"
"math/rand"
"time"
"encoding/json" "encoding/json"
"fmt"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"testing"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"math/rand"
"testing"
"time"
) )
func NewVMName() string { func NewVMName() string {
@ -32,7 +32,6 @@ func RenderConfig(config map[string]interface{}) string {
return string(j) return string(j)
} }
func TestConn(t *testing.T) *driver.Driver { func TestConn(t *testing.T) *driver.Driver {
d, err := driver.NewDriver(&driver.ConnectConfig{ d, err := driver.NewDriver(&driver.ConnectConfig{
VCenterServer: "vcenter.vsphere65.test", VCenterServer: "vcenter.vsphere65.test",
@ -57,4 +56,3 @@ func GetVM(t *testing.T, d *driver.Driver, artifacts []packer.Artifact) *driver.
return vm return vm
} }

View File

@ -1,11 +1,11 @@
package driver package driver
import ( import (
"fmt"
"github.com/vmware/govmomi/object" "github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/types"
"github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/soap" "github.com/vmware/govmomi/vim25/soap"
"fmt" "github.com/vmware/govmomi/vim25/types"
) )
type Datastore struct { type Datastore struct {

View File

@ -1,16 +1,16 @@
package driver package driver
import ( import (
"context"
"fmt"
"github.com/vmware/govmomi" "github.com/vmware/govmomi"
"github.com/vmware/govmomi/find" "github.com/vmware/govmomi/find"
"context"
"net/url"
"fmt"
"github.com/vmware/govmomi/object" "github.com/vmware/govmomi/object"
"time"
"github.com/vmware/govmomi/session" "github.com/vmware/govmomi/session"
"github.com/vmware/govmomi/vim25/soap"
"github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/soap"
"net/url"
"time"
) )
type Driver struct { type Driver struct {

View File

@ -2,10 +2,10 @@ package driver
import ( import (
"fmt" "fmt"
"math/rand"
"os" "os"
"testing" "testing"
"time" "time"
"math/rand"
) )
// Defines whether acceptance tests should be run // Defines whether acceptance tests should be run

View File

@ -1,10 +1,10 @@
package driver package driver
import ( import (
"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/types"
"github.com/vmware/govmomi/vim25/mo"
"fmt" "fmt"
"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
) )
type Folder struct { type Folder struct {

View File

@ -2,8 +2,8 @@ package driver
import ( import (
"github.com/vmware/govmomi/object" "github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/types"
"github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
) )
type Host struct { type Host struct {

View File

@ -1,10 +1,10 @@
package driver package driver
import ( import (
"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/types"
"github.com/vmware/govmomi/vim25/mo"
"fmt" "fmt"
"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
) )
type ResourcePool struct { type ResourcePool struct {

View File

@ -1,14 +1,14 @@
package driver package driver
import ( import (
"context"
"errors" "errors"
"fmt" "fmt"
"github.com/vmware/govmomi/object" "github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/vim25/types"
"time"
"strings" "strings"
"context" "time"
) )
type VirtualMachine struct { type VirtualMachine struct {

View File

@ -1,8 +1,8 @@
package driver package driver
import ( import (
"github.com/vmware/govmomi/vim25/types"
"errors" "errors"
"github.com/vmware/govmomi/vim25/types"
) )
func (vm *VirtualMachine) AddSATAController() error { func (vm *VirtualMachine) AddSATAController() error {

View File

@ -1,11 +1,11 @@
package driver package driver
import ( import (
"context"
"log" "log"
"net" "net"
"testing" "testing"
"time" "time"
"context"
) )
func TestVMAcc_clone(t *testing.T) { func TestVMAcc_clone(t *testing.T) {

View File

@ -1,11 +1,11 @@
package driver package driver
import ( import (
"github.com/vmware/govmomi/vim25/methods"
"github.com/vmware/govmomi/vim25/types"
"golang.org/x/mobile/event/key"
"strings" "strings"
"unicode" "unicode"
"github.com/vmware/govmomi/vim25/types"
"github.com/vmware/govmomi/vim25/methods"
"golang.org/x/mobile/event/key"
) )
type KeyInput struct { type KeyInput struct {

View File

@ -1,13 +1,12 @@
package main package main
import ( import (
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"fmt" "fmt"
"context" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
) )
func main() { func main() {
d, err := driver.NewDriver(context.TODO(), &driver.ConnectConfig{ d, err := driver.NewDriver(&driver.ConnectConfig{
VCenterServer: "vcenter.vsphere65.test", VCenterServer: "vcenter.vsphere65.test",
Username: "root", Username: "root",
Password: "jetbrains", Password: "jetbrains",

View File

@ -2,11 +2,11 @@ package iso
import ( import (
packerCommon "github.com/hashicorp/packer/common" packerCommon "github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/helper/communicator"
) )
type Builder struct { type Builder struct {

View File

@ -3,10 +3,10 @@ package iso
import ( import (
packerCommon "github.com/hashicorp/packer/common" packerCommon "github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/config"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/template/interpolate" "github.com/hashicorp/packer/template/interpolate"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"github.com/hashicorp/packer/helper/config"
) )
type Config struct { type Config struct {

View File

@ -1,11 +1,11 @@
package iso package iso
import ( import (
"context"
"fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"fmt"
"context"
) )
type CDRomConfig struct { type CDRomConfig struct {
@ -20,7 +20,7 @@ type StepAddCDRom struct {
func (c *CDRomConfig) Prepare() []error { func (c *CDRomConfig) Prepare() []error {
var errs []error var errs []error
if (c.CdromType != "" && c.CdromType != "ide" && c.CdromType != "sata") { if c.CdromType != "" && c.CdromType != "ide" && c.CdromType != "sata" {
errs = append(errs, fmt.Errorf("'cdrom_type' must be 'ide' or 'sata'")) errs = append(errs, fmt.Errorf("'cdrom_type' must be 'ide' or 'sata'"))
} }

View File

@ -1,11 +1,11 @@
package iso package iso
import ( import (
"context"
"fmt"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"fmt"
"context"
) )
type FloppyConfig struct { type FloppyConfig struct {

View File

@ -1,18 +1,18 @@
package iso package iso
import ( import (
"context"
"fmt"
"github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"fmt"
"time"
"strings"
"golang.org/x/mobile/event/key" "golang.org/x/mobile/event/key"
"unicode/utf8"
"github.com/hashicorp/packer/common"
"os"
"log" "log"
"context" "os"
"strings"
"time"
"unicode/utf8"
) )
type BootConfig struct { type BootConfig struct {

View File

@ -1,12 +1,12 @@
package iso package iso
import ( import (
"context"
"fmt" "fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"context"
) )
type CreateConfig struct { type CreateConfig struct {
@ -34,7 +34,7 @@ func (c *CreateConfig) Prepare() []error {
c.GuestOSType = "otherGuest" c.GuestOSType = "otherGuest"
} }
if (c.Firmware != "" && c.Firmware != "bios" && c.Firmware != "efi") { if c.Firmware != "" && c.Firmware != "bios" && c.Firmware != "efi" {
errs = append(errs, fmt.Errorf("'firmware' must be 'bios' or 'efi'")) errs = append(errs, fmt.Errorf("'firmware' must be 'bios' or 'efi'"))
} }

View File

@ -1,10 +1,10 @@
package iso package iso
import ( import (
"context"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"context"
) )
type StepRemoveCDRom struct{} type StepRemoveCDRom struct{}

View File

@ -1,11 +1,11 @@
package iso package iso
import ( import (
"context"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/vim25/types"
"context"
) )
type StepRemoveFloppy struct { type StepRemoveFloppy struct {