Merge pull request #24525 from Luap99/lint

update golangci-lint to v1.62.0
This commit is contained in:
openshift-merge-bot[bot] 2024-11-13 21:47:38 +00:00 committed by GitHub
commit ecaf9bf515
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 75 additions and 71 deletions

View File

@ -27,7 +27,6 @@ linters:
- wsl - wsl
- godox - godox
- tparallel - tparallel
- gomnd
- nlreturn - nlreturn
- noctx - noctx
- nestif - nestif
@ -62,7 +61,6 @@ linters:
- nonamedreturns - nonamedreturns
- exhaustruct - exhaustruct
# deprecated linters # deprecated linters
- execinquery
- exportloopref - exportloopref
linters-settings: linters-settings:
errcheck: errcheck:
@ -90,3 +88,8 @@ issues:
- dependencies - dependencies
exclude-files: exclude-files:
- swagger.go - swagger.go
exclude-rules:
# Exclude recvcheck from running on the imported k8s files, to much failures
- path: pkg/k8s.io/
linters:
- recvcheck

View File

@ -62,7 +62,7 @@ BUILDTAGS += ${EXTRA_BUILDTAGS}
# N/B: This value is managed by Renovate, manual changes are # N/B: This value is managed by Renovate, manual changes are
# possible, as long as they don't disturb the formatting # possible, as long as they don't disturb the formatting
# (i.e. DO NOT ADD A 'v' prefix!) # (i.e. DO NOT ADD A 'v' prefix!)
GOLANGCI_LINT_VERSION := 1.61.0 GOLANGCI_LINT_VERSION := 1.62.0
PYTHON ?= $(shell command -v python3 python|head -n1) PYTHON ?= $(shell command -v python3 python|head -n1)
PKG_MANAGER ?= $(shell command -v dnf yum|head -n1) PKG_MANAGER ?= $(shell command -v dnf yum|head -n1)
# ~/.local/bin is not in PATH on all systems # ~/.local/bin is not in PATH on all systems

View File

@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
//nolint:recvcheck // We like to test mixed pointer receiver and non-pointer receiver
type Car struct { type Car struct {
Brand string Brand string
Stats struct { Stats struct {

View File

@ -319,7 +319,7 @@ func (d *dfSummary) Reclaimable() string {
return fmt.Sprintf("%s (%d%%)", units.HumanSize(float64(d.RawReclaimable)), percent) return fmt.Sprintf("%s (%d%%)", units.HumanSize(float64(d.RawReclaimable)), percent)
} }
func (d dfSummary) MarshalJSON() ([]byte, error) { func (d *dfSummary) MarshalJSON() ([]byte, error) {
// need to create a new type here to prevent infinite recursion in MarshalJSON() call // need to create a new type here to prevent infinite recursion in MarshalJSON() call
type rawDf dfSummary type rawDf dfSummary
@ -329,5 +329,5 @@ func (d dfSummary) MarshalJSON() ([]byte, error) {
TotalCount int TotalCount int
Size string Size string
Reclaimable string Reclaimable string
}{rawDf(d), d.Total, d.Size(), d.Reclaimable()}) }{rawDf(*d), d.Total, d.Size(), d.Reclaimable()})
} }

View File

@ -23,13 +23,13 @@ func handleError(data []byte, unmarshalErrorInto interface{}) error {
// Process drains the response body, and processes the HTTP status code // Process drains the response body, and processes the HTTP status code
// Note: Closing the response.Body is left to the caller // Note: Closing the response.Body is left to the caller
func (h APIResponse) Process(unmarshalInto interface{}) error { func (h *APIResponse) Process(unmarshalInto interface{}) error {
return h.ProcessWithError(unmarshalInto, &errorhandling.ErrorModel{}) return h.ProcessWithError(unmarshalInto, &errorhandling.ErrorModel{})
} }
// ProcessWithError drains the response body, and processes the HTTP status code // ProcessWithError drains the response body, and processes the HTTP status code
// Note: Closing the response.Body is left to the caller // Note: Closing the response.Body is left to the caller
func (h APIResponse) ProcessWithError(unmarshalInto interface{}, unmarshalErrorInto interface{}) error { func (h *APIResponse) ProcessWithError(unmarshalInto interface{}, unmarshalErrorInto interface{}) error {
data, err := io.ReadAll(h.Response.Body) data, err := io.ReadAll(h.Response.Body)
if err != nil { if err != nil {
return fmt.Errorf("unable to process API response: %w", err) return fmt.Errorf("unable to process API response: %w", err)

View File

@ -324,7 +324,7 @@ func (ic *ContainerEngine) Unshare(ctx context.Context, args []string, options e
return unshare() return unshare()
} }
func (ic ContainerEngine) Version(ctx context.Context) (*entities.SystemVersionReport, error) { func (ic *ContainerEngine) Version(ctx context.Context) (*entities.SystemVersionReport, error) {
var report entities.SystemVersionReport var report entities.SystemVersionReport
v, err := define.GetVersion() v, err := define.GetVersion()
if err != nil { if err != nil {
@ -334,7 +334,7 @@ func (ic ContainerEngine) Version(ctx context.Context) (*entities.SystemVersionR
return &report, err return &report, err
} }
func (ic ContainerEngine) Locks(ctx context.Context) (*entities.LocksReport, error) { func (ic *ContainerEngine) Locks(ctx context.Context) (*entities.LocksReport, error) {
var report entities.LocksReport var report entities.LocksReport
conflicts, held, err := ic.Libpod.LockConflicts() conflicts, held, err := ic.Libpod.LockConflicts()
if err != nil { if err != nil {
@ -345,7 +345,7 @@ func (ic ContainerEngine) Locks(ctx context.Context) (*entities.LocksReport, err
return &report, nil return &report, nil
} }
func (ic ContainerEngine) SystemCheck(ctx context.Context, options entities.SystemCheckOptions) (*entities.SystemCheckReport, error) { func (ic *ContainerEngine) SystemCheck(ctx context.Context, options entities.SystemCheckOptions) (*entities.SystemCheckReport, error) {
report, err := ic.Libpod.SystemCheck(ctx, options) report, err := ic.Libpod.SystemCheck(ctx, options)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -52,10 +52,10 @@ func (ic *ContainerEngine) Unshare(ctx context.Context, args []string, options e
return errors.New("unshare is not supported on remote clients") return errors.New("unshare is not supported on remote clients")
} }
func (ic ContainerEngine) Version(ctx context.Context) (*entities.SystemVersionReport, error) { func (ic *ContainerEngine) Version(ctx context.Context) (*entities.SystemVersionReport, error) {
return system.Version(ic.ClientCtx, nil) return system.Version(ic.ClientCtx, nil)
} }
func (ic ContainerEngine) Locks(ctx context.Context) (*entities.LocksReport, error) { func (ic *ContainerEngine) Locks(ctx context.Context) (*entities.LocksReport, error) {
return nil, errors.New("locks is not supported on remote clients") return nil, errors.New("locks is not supported on remote clients")
} }

View File

@ -30,19 +30,19 @@ type AppleHVStubber struct {
vmconfigs.AppleHVConfig vmconfigs.AppleHVConfig
} }
func (a AppleHVStubber) UserModeNetworkEnabled(_ *vmconfigs.MachineConfig) bool { func (a *AppleHVStubber) UserModeNetworkEnabled(_ *vmconfigs.MachineConfig) bool {
return true return true
} }
func (a AppleHVStubber) UseProviderNetworkSetup() bool { func (a *AppleHVStubber) UseProviderNetworkSetup() bool {
return false return false
} }
func (a AppleHVStubber) RequireExclusiveActive() bool { func (a *AppleHVStubber) RequireExclusiveActive() bool {
return true return true
} }
func (a AppleHVStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.MachineConfig, ignBuilder *ignition.IgnitionBuilder) error { func (a *AppleHVStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.MachineConfig, ignBuilder *ignition.IgnitionBuilder) error {
mc.AppleHypervisor = new(vmconfigs.AppleHVConfig) mc.AppleHypervisor = new(vmconfigs.AppleHVConfig)
mc.AppleHypervisor.Vfkit = vfkit.Helper{} mc.AppleHypervisor.Vfkit = vfkit.Helper{}
bl := vfConfig.NewEFIBootloader(fmt.Sprintf("%s/efi-bl-%s", opts.Dirs.DataDir.GetPath(), opts.Name), true) bl := vfConfig.NewEFIBootloader(fmt.Sprintf("%s/efi-bl-%s", opts.Dirs.DataDir.GetPath(), opts.Name), true)
@ -79,25 +79,25 @@ func (a AppleHVStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.Machine
return apple.ResizeDisk(mc, mc.Resources.DiskSize) return apple.ResizeDisk(mc, mc.Resources.DiskSize)
} }
func (a AppleHVStubber) Exists(name string) (bool, error) { func (a *AppleHVStubber) Exists(name string) (bool, error) {
// not applicable for applehv // not applicable for applehv
return false, nil return false, nil
} }
func (a AppleHVStubber) MountType() vmconfigs.VolumeMountType { func (a *AppleHVStubber) MountType() vmconfigs.VolumeMountType {
return vmconfigs.VirtIOFS return vmconfigs.VirtIOFS
} }
func (a AppleHVStubber) MountVolumesToVM(_ *vmconfigs.MachineConfig, _ bool) error { func (a *AppleHVStubber) MountVolumesToVM(_ *vmconfigs.MachineConfig, _ bool) error {
// virtiofs: nothing to do here // virtiofs: nothing to do here
return nil return nil
} }
func (a AppleHVStubber) RemoveAndCleanMachines(_ *define.MachineDirs) error { func (a *AppleHVStubber) RemoveAndCleanMachines(_ *define.MachineDirs) error {
return nil return nil
} }
func (a AppleHVStubber) SetProviderAttrs(mc *vmconfigs.MachineConfig, opts define.SetOptions) error { func (a *AppleHVStubber) SetProviderAttrs(mc *vmconfigs.MachineConfig, opts define.SetOptions) error {
state, err := a.State(mc, false) state, err := a.State(mc, false)
if err != nil { if err != nil {
return err return err
@ -105,11 +105,11 @@ func (a AppleHVStubber) SetProviderAttrs(mc *vmconfigs.MachineConfig, opts defin
return apple.SetProviderAttrs(mc, opts, state) return apple.SetProviderAttrs(mc, opts, state)
} }
func (a AppleHVStubber) StartNetworking(mc *vmconfigs.MachineConfig, cmd *gvproxy.GvproxyCommand) error { func (a *AppleHVStubber) StartNetworking(mc *vmconfigs.MachineConfig, cmd *gvproxy.GvproxyCommand) error {
return apple.StartGenericNetworking(mc, cmd) return apple.StartGenericNetworking(mc, cmd)
} }
func (a AppleHVStubber) StartVM(mc *vmconfigs.MachineConfig) (func() error, func() error, error) { func (a *AppleHVStubber) StartVM(mc *vmconfigs.MachineConfig) (func() error, func() error, error) {
bl := mc.AppleHypervisor.Vfkit.VirtualMachine.Bootloader bl := mc.AppleHypervisor.Vfkit.VirtualMachine.Bootloader
if bl == nil { if bl == nil {
return nil, nil, fmt.Errorf("unable to determine boot loader for this machine") return nil, nil, fmt.Errorf("unable to determine boot loader for this machine")
@ -130,24 +130,24 @@ func (a AppleHVStubber) StartVM(mc *vmconfigs.MachineConfig) (func() error, func
return apple.StartGenericAppleVM(mc, vfkitCommand, bl, mc.AppleHypervisor.Vfkit.Endpoint) return apple.StartGenericAppleVM(mc, vfkitCommand, bl, mc.AppleHypervisor.Vfkit.Endpoint)
} }
func (a AppleHVStubber) StopHostNetworking(_ *vmconfigs.MachineConfig, _ define.VMType) error { func (a *AppleHVStubber) StopHostNetworking(_ *vmconfigs.MachineConfig, _ define.VMType) error {
return nil return nil
} }
func (a AppleHVStubber) UpdateSSHPort(mc *vmconfigs.MachineConfig, port int) error { func (a *AppleHVStubber) UpdateSSHPort(mc *vmconfigs.MachineConfig, port int) error {
// managed by gvproxy on this backend, so nothing to do // managed by gvproxy on this backend, so nothing to do
return nil return nil
} }
func (a AppleHVStubber) VMType() define.VMType { func (a *AppleHVStubber) VMType() define.VMType {
return define.AppleHvVirt return define.AppleHvVirt
} }
func (a AppleHVStubber) PrepareIgnition(_ *vmconfigs.MachineConfig, _ *ignition.IgnitionBuilder) (*ignition.ReadyUnitOpts, error) { func (a *AppleHVStubber) PrepareIgnition(_ *vmconfigs.MachineConfig, _ *ignition.IgnitionBuilder) (*ignition.ReadyUnitOpts, error) {
return nil, nil return nil, nil
} }
func (a AppleHVStubber) PostStartNetworking(mc *vmconfigs.MachineConfig, noInfo bool) error { func (a *AppleHVStubber) PostStartNetworking(mc *vmconfigs.MachineConfig, noInfo bool) error {
return nil return nil
} }

View File

@ -4,7 +4,7 @@ type basicMachine struct {
args []string args []string
} }
func (s basicMachine) buildCmd(m *machineTestBuilder) []string { func (s *basicMachine) buildCmd(m *machineTestBuilder) []string {
cmd := []string{"-r"} cmd := []string{"-r"}
if len(s.args) > 0 { if len(s.args) > 0 {
cmd = append(cmd, s.args...) cmd = append(cmd, s.args...)

View File

@ -9,7 +9,7 @@ type sshMachine struct {
sshCommand []string sshCommand []string
} }
func (s sshMachine) buildCmd(m *machineTestBuilder) []string { func (s *sshMachine) buildCmd(m *machineTestBuilder) []string {
cmd := []string{"machine", "ssh"} cmd := []string{"machine", "ssh"}
if len(m.name) > 0 { if len(m.name) > 0 {
cmd = append(cmd, m.name) cmd = append(cmd, m.name)

View File

@ -8,7 +8,7 @@ type startMachine struct {
noInfo bool noInfo bool
} }
func (s startMachine) buildCmd(m *machineTestBuilder) []string { func (s *startMachine) buildCmd(m *machineTestBuilder) []string {
cmd := []string{"machine", "start"} cmd := []string{"machine", "start"}
if len(m.name) > 0 { if len(m.name) > 0 {
cmd = append(cmd, m.name) cmd = append(cmd, m.name)
@ -22,12 +22,12 @@ func (s startMachine) buildCmd(m *machineTestBuilder) []string {
return cmd return cmd
} }
func (s startMachine) withQuiet() startMachine { func (s *startMachine) withQuiet() *startMachine {
s.quiet = true s.quiet = true
return s return s
} }
func (s startMachine) withNoInfo() startMachine { func (s *startMachine) withNoInfo() *startMachine {
s.noInfo = true s.noInfo = true
return s return s
} }

View File

@ -8,7 +8,7 @@ type listSystemConnection struct {
format string format string
} }
func (l listSystemConnection) buildCmd(m *machineTestBuilder) []string { func (l *listSystemConnection) buildCmd(m *machineTestBuilder) []string {
cmd := []string{"system", "connection", "list"} cmd := []string{"system", "connection", "list"}
if len(l.format) > 0 { if len(l.format) > 0 {
cmd = append(cmd, "--format", l.format) cmd = append(cmd, "--format", l.format)

View File

@ -111,7 +111,7 @@ var _ = Describe("podman machine init", func() {
Expect(inspectBefore).ToNot(BeEmpty()) Expect(inspectBefore).ToNot(BeEmpty())
Expect(inspectBefore[0].Name).To(Equal(mb.names[0])) Expect(inspectBefore[0].Name).To(Equal(mb.names[0]))
s := startMachine{} s := &startMachine{}
ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run() ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(ssession).Should(Exit(0)) Expect(ssession).Should(Exit(0))
@ -217,7 +217,7 @@ var _ = Describe("podman machine init", func() {
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0)) Expect(session).To(Exit(0))
ssh := sshMachine{} ssh := &sshMachine{}
sshSession, err := mb.setName(name).setCmd(ssh.withSSHCommand([]string{"ls /very-long-test-mount-dir-path-more-than-thirty-six-bytes"})).run() sshSession, err := mb.setName(name).setCmd(ssh.withSSHCommand([]string{"ls /very-long-test-mount-dir-path-more-than-thirty-six-bytes"})).run()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(sshSession).To(Exit(0)) Expect(sshSession).To(Exit(0))
@ -231,7 +231,7 @@ var _ = Describe("podman machine init", func() {
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0)) Expect(session).To(Exit(0))
s := startMachine{} s := &startMachine{}
ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run() ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(ssession).Should(Exit(0)) Expect(ssession).Should(Exit(0))
@ -254,7 +254,7 @@ var _ = Describe("podman machine init", func() {
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0)) Expect(session).To(Exit(0))
s := startMachine{} s := &startMachine{}
ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run() ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(ssession).Should(Exit(0)) Expect(ssession).Should(Exit(0))
@ -386,7 +386,7 @@ var _ = Describe("podman machine init", func() {
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0)) Expect(session).To(Exit(0))
s := startMachine{} s := &startMachine{}
ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run() ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(ssession).Should(Exit(0)) Expect(ssession).Should(Exit(0))
@ -437,7 +437,7 @@ var _ = Describe("podman machine init", func() {
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0)) Expect(session).To(Exit(0))
s := startMachine{} s := &startMachine{}
ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run() ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(ssession).Should(Exit(0)) Expect(ssession).Should(Exit(0))

View File

@ -26,7 +26,7 @@ package e2e_test
// Expect(err).ToNot(HaveOccurred()) // Expect(err).ToNot(HaveOccurred())
// Expect(foo1).To(Exit(0)) // Expect(foo1).To(Exit(0))
// ssh := sshMachine{} // ssh := &sshMachine{}
// sshSession, err := mb.setName("foo1").setCmd(ssh.withSSHComand([]string{"podman", "pull", "quay.io/baude/podman_next"})).run() // sshSession, err := mb.setName("foo1").setCmd(ssh.withSSHComand([]string{"podman", "pull", "quay.io/baude/podman_next"})).run()
// Expect(err).ToNot(HaveOccurred()) // Expect(err).ToNot(HaveOccurred())
// Expect(sshSession).To(Exit(0)) // Expect(sshSession).To(Exit(0))

View File

@ -11,7 +11,7 @@ var _ = Describe("podman machine ssh", func() {
It("bad machine name", func() { It("bad machine name", func() {
name := randomString() name := randomString()
ssh := sshMachine{} ssh := &sshMachine{}
session, err := mb.setName(name).setCmd(ssh).run() session, err := mb.setName(name).setCmd(ssh).run()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(125)) Expect(session).To(Exit(125))
@ -25,7 +25,7 @@ var _ = Describe("podman machine ssh", func() {
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0)) Expect(session).To(Exit(0))
ssh := sshMachine{} ssh := &sshMachine{}
sshSession, err := mb.setName(name).setCmd(ssh).run() sshSession, err := mb.setName(name).setCmd(ssh).run()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(sshSession.errorToString()).To(ContainSubstring("is not running")) Expect(sshSession.errorToString()).To(ContainSubstring("is not running"))
@ -40,7 +40,7 @@ var _ = Describe("podman machine ssh", func() {
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0)) Expect(session).To(Exit(0))
ssh := sshMachine{} ssh := &sshMachine{}
sshSession, err := mb.setName(name).setCmd(ssh.withSSHCommand([]string{"cat", "/etc/os-release"})).run() sshSession, err := mb.setName(name).setCmd(ssh.withSSHCommand([]string{"cat", "/etc/os-release"})).run()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(sshSession).To(Exit(0)) Expect(sshSession).To(Exit(0))

View File

@ -143,7 +143,7 @@ var _ = Describe("podman machine start", func() {
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(session2).To(Exit(0)) Expect(session2).To(Exit(0))
s := startMachine{} s := &startMachine{}
session3, err := mb.setName(startme).setCmd(s).setTimeout(time.Minute * 10).run() session3, err := mb.setName(startme).setCmd(s).setTimeout(time.Minute * 10).run()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(session3).Should(Exit(0)) Expect(session3).Should(Exit(0))
@ -181,14 +181,14 @@ var _ = Describe("podman machine start", func() {
go func() { go func() {
defer GinkgoRecover() defer GinkgoRecover()
defer wg.Done() defer wg.Done()
s := startMachine{} s := &startMachine{}
startSession1, err = mb.setName(machine1).setCmd(s).setTimeout(time.Minute * 10).run() startSession1, err = mb.setName(machine1).setCmd(s).setTimeout(time.Minute * 10).run()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
}() }()
go func() { go func() {
defer GinkgoRecover() defer GinkgoRecover()
defer wg.Done() defer wg.Done()
s := startMachine{} s := &startMachine{}
// ok this is a hack and should not be needed but the way these test are setup they all // ok this is a hack and should not be needed but the way these test are setup they all
// share "mb" which stores the name that is used for the VM, thus running two parallel // share "mb" which stores the name that is used for the VM, thus running two parallel
// can overwrite the name from the other, work around that by creating a new mb for the // can overwrite the name from the other, work around that by creating a new mb for the

View File

@ -26,7 +26,7 @@ type LibKrunStubber struct {
vmconfigs.AppleHVConfig vmconfigs.AppleHVConfig
} }
func (l LibKrunStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.MachineConfig, builder *ignition.IgnitionBuilder) error { func (l *LibKrunStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.MachineConfig, builder *ignition.IgnitionBuilder) error {
mc.LibKrunHypervisor = new(vmconfigs.LibKrunConfig) mc.LibKrunHypervisor = new(vmconfigs.LibKrunConfig)
mc.LibKrunHypervisor.KRun = vfkit.Helper{} mc.LibKrunHypervisor.KRun = vfkit.Helper{}
@ -54,32 +54,32 @@ func (l LibKrunStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.Machine
return apple.ResizeDisk(mc, mc.Resources.DiskSize) return apple.ResizeDisk(mc, mc.Resources.DiskSize)
} }
func (l LibKrunStubber) PrepareIgnition(mc *vmconfigs.MachineConfig, ignBuilder *ignition.IgnitionBuilder) (*ignition.ReadyUnitOpts, error) { func (l *LibKrunStubber) PrepareIgnition(mc *vmconfigs.MachineConfig, ignBuilder *ignition.IgnitionBuilder) (*ignition.ReadyUnitOpts, error) {
return nil, nil return nil, nil
} }
func (l LibKrunStubber) Exists(name string) (bool, error) { func (l *LibKrunStubber) Exists(name string) (bool, error) {
// not applicable for libkrun (same as applehv) // not applicable for libkrun (same as applehv)
return false, nil return false, nil
} }
func (l LibKrunStubber) MountType() vmconfigs.VolumeMountType { func (l *LibKrunStubber) MountType() vmconfigs.VolumeMountType {
return vmconfigs.VirtIOFS return vmconfigs.VirtIOFS
} }
func (l LibKrunStubber) MountVolumesToVM(mc *vmconfigs.MachineConfig, quiet bool) error { func (l *LibKrunStubber) MountVolumesToVM(mc *vmconfigs.MachineConfig, quiet bool) error {
return nil return nil
} }
func (l LibKrunStubber) Remove(mc *vmconfigs.MachineConfig) ([]string, func() error, error) { func (l *LibKrunStubber) Remove(mc *vmconfigs.MachineConfig) ([]string, func() error, error) {
return []string{}, func() error { return nil }, nil return []string{}, func() error { return nil }, nil
} }
func (l LibKrunStubber) RemoveAndCleanMachines(dirs *define.MachineDirs) error { func (l *LibKrunStubber) RemoveAndCleanMachines(dirs *define.MachineDirs) error {
return nil return nil
} }
func (l LibKrunStubber) SetProviderAttrs(mc *vmconfigs.MachineConfig, opts define.SetOptions) error { func (l *LibKrunStubber) SetProviderAttrs(mc *vmconfigs.MachineConfig, opts define.SetOptions) error {
state, err := l.State(mc, false) state, err := l.State(mc, false)
if err != nil { if err != nil {
return err return err
@ -87,15 +87,15 @@ func (l LibKrunStubber) SetProviderAttrs(mc *vmconfigs.MachineConfig, opts defin
return apple.SetProviderAttrs(mc, opts, state) return apple.SetProviderAttrs(mc, opts, state)
} }
func (l LibKrunStubber) StartNetworking(mc *vmconfigs.MachineConfig, cmd *gvproxy.GvproxyCommand) error { func (l *LibKrunStubber) StartNetworking(mc *vmconfigs.MachineConfig, cmd *gvproxy.GvproxyCommand) error {
return apple.StartGenericNetworking(mc, cmd) return apple.StartGenericNetworking(mc, cmd)
} }
func (l LibKrunStubber) PostStartNetworking(mc *vmconfigs.MachineConfig, noInfo bool) error { func (l *LibKrunStubber) PostStartNetworking(mc *vmconfigs.MachineConfig, noInfo bool) error {
return nil return nil
} }
func (l LibKrunStubber) StartVM(mc *vmconfigs.MachineConfig) (func() error, func() error, error) { func (l *LibKrunStubber) StartVM(mc *vmconfigs.MachineConfig) (func() error, func() error, error) {
bl := mc.LibKrunHypervisor.KRun.VirtualMachine.Bootloader bl := mc.LibKrunHypervisor.KRun.VirtualMachine.Bootloader
if bl == nil { if bl == nil {
return nil, nil, fmt.Errorf("unable to determine boot loader for this machine") return nil, nil, fmt.Errorf("unable to determine boot loader for this machine")
@ -103,38 +103,38 @@ func (l LibKrunStubber) StartVM(mc *vmconfigs.MachineConfig) (func() error, func
return apple.StartGenericAppleVM(mc, krunkitBinary, bl, mc.LibKrunHypervisor.KRun.Endpoint) return apple.StartGenericAppleVM(mc, krunkitBinary, bl, mc.LibKrunHypervisor.KRun.Endpoint)
} }
func (l LibKrunStubber) State(mc *vmconfigs.MachineConfig, bypass bool) (define.Status, error) { func (l *LibKrunStubber) State(mc *vmconfigs.MachineConfig, bypass bool) (define.Status, error) {
return mc.LibKrunHypervisor.KRun.State() return mc.LibKrunHypervisor.KRun.State()
} }
func (l LibKrunStubber) StopVM(mc *vmconfigs.MachineConfig, hardStop bool) error { func (l *LibKrunStubber) StopVM(mc *vmconfigs.MachineConfig, hardStop bool) error {
return mc.LibKrunHypervisor.KRun.Stop(hardStop, true) return mc.LibKrunHypervisor.KRun.Stop(hardStop, true)
} }
func (l LibKrunStubber) StopHostNetworking(mc *vmconfigs.MachineConfig, vmType define.VMType) error { func (l *LibKrunStubber) StopHostNetworking(mc *vmconfigs.MachineConfig, vmType define.VMType) error {
return nil return nil
} }
func (l LibKrunStubber) VMType() define.VMType { func (l *LibKrunStubber) VMType() define.VMType {
return define.LibKrun return define.LibKrun
} }
func (l LibKrunStubber) UserModeNetworkEnabled(mc *vmconfigs.MachineConfig) bool { func (l *LibKrunStubber) UserModeNetworkEnabled(mc *vmconfigs.MachineConfig) bool {
return true return true
} }
func (l LibKrunStubber) UseProviderNetworkSetup() bool { func (l *LibKrunStubber) UseProviderNetworkSetup() bool {
return false return false
} }
func (l LibKrunStubber) RequireExclusiveActive() bool { func (l *LibKrunStubber) RequireExclusiveActive() bool {
return true return true
} }
func (l LibKrunStubber) UpdateSSHPort(mc *vmconfigs.MachineConfig, port int) error { func (l *LibKrunStubber) UpdateSSHPort(mc *vmconfigs.MachineConfig, port int) error {
return nil return nil
} }
func (l LibKrunStubber) GetRosetta(mc *vmconfigs.MachineConfig) (bool, error) { func (l *LibKrunStubber) GetRosetta(mc *vmconfigs.MachineConfig) (bool, error) {
return false, nil return false, nil
} }

View File

@ -39,15 +39,15 @@ var (
gvProxyMaxBackoffAttempts = 6 gvProxyMaxBackoffAttempts = 6
) )
func (q QEMUStubber) UserModeNetworkEnabled(*vmconfigs.MachineConfig) bool { func (q *QEMUStubber) UserModeNetworkEnabled(*vmconfigs.MachineConfig) bool {
return true return true
} }
func (q QEMUStubber) UseProviderNetworkSetup() bool { func (q *QEMUStubber) UseProviderNetworkSetup() bool {
return false return false
} }
func (q QEMUStubber) RequireExclusiveActive() bool { func (q *QEMUStubber) RequireExclusiveActive() bool {
return true return true
} }

View File

@ -413,7 +413,7 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
return p return p
} }
func (p PodmanTestIntegration) AddImageToRWStore(image string) { func (p *PodmanTestIntegration) AddImageToRWStore(image string) {
if err := p.RestoreArtifact(image); err != nil { if err := p.RestoreArtifact(image); err != nil {
logrus.Errorf("Unable to restore %s to RW store", image) logrus.Errorf("Unable to restore %s to RW store", image)
} }