golint: Fix lint offences
This commit is contained in:
parent
00a90e622b
commit
73d87b07de
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/mitchellh/packer/packer"
|
||||
)
|
||||
|
||||
// This is the common builder ID to all of these artifacts.
|
||||
// BuilderId is the common builder ID to all of these artifacts.
|
||||
const BuilderId = "packer.parallels"
|
||||
|
||||
// These are the extensions of files and directories that are unnecessary for the function
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// A driver is able to talk to Parallels and perform certain
|
||||
// Driver is the interface that talks to Parallels and performs certain
|
||||
// operations with it. Some of the operations on here may seem overly
|
||||
// specific, but they were built specifically in mind to handle features
|
||||
// of the Parallels builder for Packer, and to abstract differences in
|
||||
|
|
|
@ -24,13 +24,12 @@ func (d *Parallels11Driver) Verify() error {
|
|||
if matches == nil {
|
||||
return fmt.Errorf(
|
||||
"Could not determine your Parallels Desktop edition using: %s info --license", d.PrlsrvctlPath)
|
||||
} else {
|
||||
switch matches[1] {
|
||||
case "pro", "business":
|
||||
break
|
||||
default:
|
||||
return fmt.Errorf("Packer can be used only with Parallels Desktop 11 Pro or Business edition. You use: %s edition", matches[1])
|
||||
}
|
||||
}
|
||||
switch matches[1] {
|
||||
case "pro", "business":
|
||||
break
|
||||
default:
|
||||
return fmt.Errorf("Packer can be used only with Parallels Desktop 11 Pro or Business edition. You use: %s edition", matches[1])
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package common
|
||||
|
||||
// Interface to help find the host IP that is available from within
|
||||
// HostIPFinder allows to find the host IP that is available from within
|
||||
// the Parallels virtual machines.
|
||||
type HostIPFinder interface {
|
||||
HostIP() (string, error)
|
||||
|
|
|
@ -50,5 +50,5 @@ func (f *IfconfigIPFinder) HostIP() (string, error) {
|
|||
}
|
||||
}
|
||||
}
|
||||
return "", errors.New("IP not found in ifconfig output...")
|
||||
return "", errors.New("IP not found in ifconfig output")
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/mitchellh/packer/packer"
|
||||
)
|
||||
|
||||
// This step attaches a floppy to the virtual machine.
|
||||
// StepAttachFloppy is a step that attaches a floppy to the virtual machine.
|
||||
//
|
||||
// Uses:
|
||||
// driver Driver
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
"github.com/mitchellh/packer/packer"
|
||||
)
|
||||
|
||||
// This step attaches the Parallels Tools as an inserted CD onto
|
||||
// the virtual machine.
|
||||
// StepAttachParallelsTools is a step that attaches Parallels Tools ISO image
|
||||
// as an inserted CD onto the virtual machine.
|
||||
//
|
||||
// Uses:
|
||||
// driver Driver
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
"github.com/mitchellh/packer/packer"
|
||||
)
|
||||
|
||||
// This step removes all empty blocks from expanding Parallels virtual disks
|
||||
// and reduces the result disk size
|
||||
// StepCompactDisk is a step that removes all empty blocks from expanding
|
||||
// Parallels virtual disks and reduces the result disk size
|
||||
//
|
||||
// Uses:
|
||||
// driver Driver
|
||||
|
|
|
@ -7,7 +7,8 @@ import (
|
|||
"github.com/mitchellh/multistep"
|
||||
)
|
||||
|
||||
// This step prepares parameters related to Parallels Tools.
|
||||
// StepPrepareParallelsTools is a step that prepares parameters related
|
||||
// to Parallels Tools.
|
||||
//
|
||||
// Uses:
|
||||
// driver Driver
|
||||
|
|
|
@ -13,8 +13,8 @@ type commandTemplate struct {
|
|||
Name string
|
||||
}
|
||||
|
||||
// This step executes additional prlctl commands as specified by the
|
||||
// template.
|
||||
// StepPrlctl is a step that executes additional prlctl commands as specified
|
||||
// by the template.
|
||||
//
|
||||
// Uses:
|
||||
// driver Driver
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/mitchellh/packer/packer"
|
||||
)
|
||||
|
||||
// This step starts the virtual machine.
|
||||
// StepRun is a step that starts the virtual machine.
|
||||
//
|
||||
// Uses:
|
||||
// driver Driver
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
"github.com/mitchellh/packer/packer"
|
||||
)
|
||||
|
||||
// This step shuts down the machine. It first attempts to do so gracefully,
|
||||
// but ultimately forcefully shuts it down if that fails.
|
||||
// StepShutdown is a step that shuts down the machine. It first attempts to do
|
||||
// so gracefully, but ultimately forcefully shuts it down if that fails.
|
||||
//
|
||||
// Uses:
|
||||
// communicator packer.Communicator
|
||||
|
|
|
@ -19,8 +19,8 @@ type bootCommandTemplateData struct {
|
|||
Name string
|
||||
}
|
||||
|
||||
// This step "types" the boot command into the VM via the prltype script, built on the
|
||||
// Parallels Virtualization SDK - Python API.
|
||||
// StepTypeBootCommand is a step that "types" the boot command into the VM via
|
||||
// the prltype script, built on the Parallels Virtualization SDK - Python API.
|
||||
//
|
||||
// Uses:
|
||||
// driver Driver
|
||||
|
@ -48,7 +48,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
|
|||
pauseFn = state.Get("pauseFn").(multistep.DebugPauseFn)
|
||||
}
|
||||
|
||||
hostIp := "0.0.0.0"
|
||||
hostIP := "0.0.0.0"
|
||||
|
||||
if len(s.HostInterfaces) > 0 {
|
||||
// Determine the host IP
|
||||
|
@ -61,13 +61,13 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
|
|||
ui.Error(err.Error())
|
||||
return multistep.ActionHalt
|
||||
}
|
||||
hostIp = ip
|
||||
hostIP = ip
|
||||
}
|
||||
|
||||
ui.Say(fmt.Sprintf("Host IP for the Parallels machine: %s", hostIp))
|
||||
ui.Say(fmt.Sprintf("Host IP for the Parallels machine: %s", hostIP))
|
||||
|
||||
s.Ctx.Data = &bootCommandTemplateData{
|
||||
hostIp,
|
||||
hostIP,
|
||||
httpPort,
|
||||
s.VMName,
|
||||
}
|
||||
|
@ -206,12 +206,12 @@ func scancodes(message string) []string {
|
|||
|
||||
scancodeMap := make(map[rune]uint)
|
||||
for chars, start := range scancodeIndex {
|
||||
var i uint = 0
|
||||
var i uint
|
||||
for len(chars) > 0 {
|
||||
r, size := utf8.DecodeRuneInString(chars)
|
||||
chars = chars[size:]
|
||||
scancodeMap[r] = start + i
|
||||
i += 1
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,13 @@ type toolsPathTemplate struct {
|
|||
Flavor string
|
||||
}
|
||||
|
||||
// This step uploads the guest additions ISO to the VM.
|
||||
// StepUploadParallelsTools is a step that uploads the Parallels Tools ISO
|
||||
// to the VM.
|
||||
//
|
||||
// Uses:
|
||||
// communicator packer.Communicator
|
||||
// parallels_tools_path string
|
||||
// ui packer.Ui
|
||||
type StepUploadParallelsTools struct {
|
||||
ParallelsToolsFlavor string
|
||||
ParallelsToolsGuestPath string
|
||||
|
|
|
@ -9,8 +9,13 @@ import (
|
|||
"github.com/mitchellh/packer/packer"
|
||||
)
|
||||
|
||||
// This step uploads a file containing the Parallels version, which
|
||||
// can be useful for various provisioning reasons.
|
||||
// StepUploadVersion is a step that uploads a file containing the version of
|
||||
// Parallels Desktop, which can be useful for various provisioning reasons.
|
||||
//
|
||||
// Uses:
|
||||
// communicator packer.Communicator
|
||||
// driver Driver
|
||||
// ui packer.Ui
|
||||
type StepUploadVersion struct {
|
||||
Path string
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ func (c *ToolsConfig) Prepare(ctx *interpolate.Context) []error {
|
|||
|
||||
if c.ParallelsToolsFlavor == "" {
|
||||
if c.ParallelsToolsMode != ParallelsToolsModeDisable {
|
||||
errs = append(errs, errors.New("parallels_tools_flavor must be specified."))
|
||||
errs = append(errs, errors.New("parallels_tools_flavor must be specified"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue