Minor linting fixes
This commit is contained in:
parent
9c7bfe72d9
commit
153d1b5e1f
2 changed files with 9 additions and 3 deletions
|
|
@ -33,7 +33,9 @@ func createStoreOrExit() *storage.Storage {
|
|||
return store
|
||||
}
|
||||
|
||||
func runVM(passthroughArg string, fn func(context.Context, *vm.VM, *vm.FileManager, *share.NetTapRuntimeContext) int, forwardPortsRules []vm.PortForwardingRule, unrestrictedNetworking bool, withNetTap bool) int {
|
||||
type runVMFunc func(context.Context, *vm.VM, *vm.FileManager, *share.NetTapRuntimeContext) int
|
||||
|
||||
func runVM(passthroughArg string, fn runVMFunc, forwardPortsRules []vm.PortForwardingRule, unrestrictedNetworking bool, withNetTap bool) int {
|
||||
store := createStoreOrExit()
|
||||
|
||||
vmImagePath, err := store.CheckVMImageExists()
|
||||
|
|
@ -196,6 +198,10 @@ func runVM(passthroughArg string, fn func(context.Context, *vm.VM, *vm.FileManag
|
|||
ShowDisplay: vmDebugFlag,
|
||||
}
|
||||
|
||||
return innerRunVM(vmCfg, tapRuntimeCtx, fn)
|
||||
}
|
||||
|
||||
func innerRunVM(vmCfg vm.VMConfig, tapRuntimeCtx *share.NetTapRuntimeContext, fn runVMFunc) int {
|
||||
vi, err := vm.NewVM(slog.Default().With("caller", "vm"), vmCfg)
|
||||
if err != nil {
|
||||
slog.Error("Failed to create vm instance", "error", err.Error())
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func (vi *VM) ConfigureInterfaceStaticNet(ctx context.Context, iface string, cidr string) error {
|
||||
func (vm *VM) ConfigureInterfaceStaticNet(ctx context.Context, iface string, cidr string) error {
|
||||
ip, _, err := net.ParseCIDR(cidr)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "invalid cidr")
|
||||
|
|
@ -21,7 +21,7 @@ func (vi *VM) ConfigureInterfaceStaticNet(ctx context.Context, iface string, cid
|
|||
return fmt.Errorf("ipv6 addresses accepted only (have '%v')", ip)
|
||||
}
|
||||
|
||||
sc, err := vi.DialSSH()
|
||||
sc, err := vm.DialSSH()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "dial ssh")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue