diff --git a/.golangci.yml b/.golangci.yml index 3021cab9d0..d2bf70fb1e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -27,7 +27,6 @@ linters: - wsl - godox - tparallel - - gomnd - nlreturn - noctx - nestif @@ -62,7 +61,6 @@ linters: - nonamedreturns - exhaustruct # deprecated linters - - execinquery - exportloopref linters-settings: errcheck: @@ -90,3 +88,8 @@ issues: - dependencies exclude-files: - swagger.go + exclude-rules: + # Exclude recvcheck from running on the imported k8s files, to much failures + - path: pkg/k8s.io/ + linters: + - recvcheck diff --git a/Makefile b/Makefile index 7f1fbb5522..e6aee006ca 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,7 @@ BUILDTAGS += ${EXTRA_BUILDTAGS} # N/B: This value is managed by Renovate, manual changes are # possible, as long as they don't disturb the formatting # (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) PKG_MANAGER ?= $(shell command -v dnf yum|head -n1) # ~/.local/bin is not in PATH on all systems diff --git a/cmd/podman/common/completion_test.go b/cmd/podman/common/completion_test.go index 755324f3bb..7ff64a8971 100644 --- a/cmd/podman/common/completion_test.go +++ b/cmd/podman/common/completion_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/assert" ) +//nolint:recvcheck // We like to test mixed pointer receiver and non-pointer receiver type Car struct { Brand string Stats struct { diff --git a/cmd/podman/system/df.go b/cmd/podman/system/df.go index 7eebc5096c..7c7f69efc9 100644 --- a/cmd/podman/system/df.go +++ b/cmd/podman/system/df.go @@ -319,7 +319,7 @@ func (d *dfSummary) Reclaimable() string { 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 type rawDf dfSummary @@ -329,5 +329,5 @@ func (d dfSummary) MarshalJSON() ([]byte, error) { TotalCount int Size string Reclaimable string - }{rawDf(d), d.Total, d.Size(), d.Reclaimable()}) + }{rawDf(*d), d.Total, d.Size(), d.Reclaimable()}) } diff --git a/pkg/bindings/errors.go b/pkg/bindings/errors.go index af506a0f39..0b68c04db8 100644 --- a/pkg/bindings/errors.go +++ b/pkg/bindings/errors.go @@ -23,13 +23,13 @@ func handleError(data []byte, unmarshalErrorInto interface{}) error { // Process drains the response body, and processes the HTTP status code // 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{}) } // ProcessWithError drains the response body, and processes the HTTP status code // 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) if err != nil { return fmt.Errorf("unable to process API response: %w", err) diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go index 88a6cf01a8..faa076c54d 100644 --- a/pkg/domain/infra/abi/system.go +++ b/pkg/domain/infra/abi/system.go @@ -324,7 +324,7 @@ func (ic *ContainerEngine) Unshare(ctx context.Context, args []string, options e 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 v, err := define.GetVersion() if err != nil { @@ -334,7 +334,7 @@ func (ic ContainerEngine) Version(ctx context.Context) (*entities.SystemVersionR 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 conflicts, held, err := ic.Libpod.LockConflicts() if err != nil { @@ -345,7 +345,7 @@ func (ic ContainerEngine) Locks(ctx context.Context) (*entities.LocksReport, err 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) if err != nil { return nil, err diff --git a/pkg/domain/infra/tunnel/system.go b/pkg/domain/infra/tunnel/system.go index 025e902620..3230b31ee7 100644 --- a/pkg/domain/infra/tunnel/system.go +++ b/pkg/domain/infra/tunnel/system.go @@ -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") } -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) } -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") } diff --git a/pkg/machine/applehv/stubber.go b/pkg/machine/applehv/stubber.go index 54fb0e06b2..258a352dc7 100644 --- a/pkg/machine/applehv/stubber.go +++ b/pkg/machine/applehv/stubber.go @@ -30,19 +30,19 @@ type AppleHVStubber struct { vmconfigs.AppleHVConfig } -func (a AppleHVStubber) UserModeNetworkEnabled(_ *vmconfigs.MachineConfig) bool { +func (a *AppleHVStubber) UserModeNetworkEnabled(_ *vmconfigs.MachineConfig) bool { return true } -func (a AppleHVStubber) UseProviderNetworkSetup() bool { +func (a *AppleHVStubber) UseProviderNetworkSetup() bool { return false } -func (a AppleHVStubber) RequireExclusiveActive() bool { +func (a *AppleHVStubber) RequireExclusiveActive() bool { 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.Vfkit = vfkit.Helper{} 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) } -func (a AppleHVStubber) Exists(name string) (bool, error) { +func (a *AppleHVStubber) Exists(name string) (bool, error) { // not applicable for applehv return false, nil } -func (a AppleHVStubber) MountType() vmconfigs.VolumeMountType { +func (a *AppleHVStubber) MountType() vmconfigs.VolumeMountType { return vmconfigs.VirtIOFS } -func (a AppleHVStubber) MountVolumesToVM(_ *vmconfigs.MachineConfig, _ bool) error { +func (a *AppleHVStubber) MountVolumesToVM(_ *vmconfigs.MachineConfig, _ bool) error { // virtiofs: nothing to do here return nil } -func (a AppleHVStubber) RemoveAndCleanMachines(_ *define.MachineDirs) error { +func (a *AppleHVStubber) RemoveAndCleanMachines(_ *define.MachineDirs) error { 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) if err != nil { return err @@ -105,11 +105,11 @@ func (a AppleHVStubber) SetProviderAttrs(mc *vmconfigs.MachineConfig, opts defin 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) } -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 if bl == nil { 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) } -func (a AppleHVStubber) StopHostNetworking(_ *vmconfigs.MachineConfig, _ define.VMType) error { +func (a *AppleHVStubber) StopHostNetworking(_ *vmconfigs.MachineConfig, _ define.VMType) error { 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 return nil } -func (a AppleHVStubber) VMType() define.VMType { +func (a *AppleHVStubber) VMType() define.VMType { 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 } -func (a AppleHVStubber) PostStartNetworking(mc *vmconfigs.MachineConfig, noInfo bool) error { +func (a *AppleHVStubber) PostStartNetworking(mc *vmconfigs.MachineConfig, noInfo bool) error { return nil } diff --git a/pkg/machine/e2e/config_basic_test.go b/pkg/machine/e2e/config_basic_test.go index d1cb24174c..2b8909c8b8 100644 --- a/pkg/machine/e2e/config_basic_test.go +++ b/pkg/machine/e2e/config_basic_test.go @@ -4,7 +4,7 @@ type basicMachine struct { args []string } -func (s basicMachine) buildCmd(m *machineTestBuilder) []string { +func (s *basicMachine) buildCmd(m *machineTestBuilder) []string { cmd := []string{"-r"} if len(s.args) > 0 { cmd = append(cmd, s.args...) diff --git a/pkg/machine/e2e/config_ssh_test.go b/pkg/machine/e2e/config_ssh_test.go index 317478e935..cb5c1401f5 100644 --- a/pkg/machine/e2e/config_ssh_test.go +++ b/pkg/machine/e2e/config_ssh_test.go @@ -9,7 +9,7 @@ type sshMachine struct { sshCommand []string } -func (s sshMachine) buildCmd(m *machineTestBuilder) []string { +func (s *sshMachine) buildCmd(m *machineTestBuilder) []string { cmd := []string{"machine", "ssh"} if len(m.name) > 0 { cmd = append(cmd, m.name) diff --git a/pkg/machine/e2e/config_start_test.go b/pkg/machine/e2e/config_start_test.go index 57c09bc3b4..66058e5613 100644 --- a/pkg/machine/e2e/config_start_test.go +++ b/pkg/machine/e2e/config_start_test.go @@ -8,7 +8,7 @@ type startMachine struct { noInfo bool } -func (s startMachine) buildCmd(m *machineTestBuilder) []string { +func (s *startMachine) buildCmd(m *machineTestBuilder) []string { cmd := []string{"machine", "start"} if len(m.name) > 0 { cmd = append(cmd, m.name) @@ -22,12 +22,12 @@ func (s startMachine) buildCmd(m *machineTestBuilder) []string { return cmd } -func (s startMachine) withQuiet() startMachine { +func (s *startMachine) withQuiet() *startMachine { s.quiet = true return s } -func (s startMachine) withNoInfo() startMachine { +func (s *startMachine) withNoInfo() *startMachine { s.noInfo = true return s } diff --git a/pkg/machine/e2e/config_system_connection_list_test.go b/pkg/machine/e2e/config_system_connection_list_test.go index cc52745e2d..4e78bfb54b 100644 --- a/pkg/machine/e2e/config_system_connection_list_test.go +++ b/pkg/machine/e2e/config_system_connection_list_test.go @@ -8,7 +8,7 @@ type listSystemConnection struct { format string } -func (l listSystemConnection) buildCmd(m *machineTestBuilder) []string { +func (l *listSystemConnection) buildCmd(m *machineTestBuilder) []string { cmd := []string{"system", "connection", "list"} if len(l.format) > 0 { cmd = append(cmd, "--format", l.format) diff --git a/pkg/machine/e2e/init_test.go b/pkg/machine/e2e/init_test.go index 58fa3f84ff..baad3b86fc 100644 --- a/pkg/machine/e2e/init_test.go +++ b/pkg/machine/e2e/init_test.go @@ -111,7 +111,7 @@ var _ = Describe("podman machine init", func() { Expect(inspectBefore).ToNot(BeEmpty()) Expect(inspectBefore[0].Name).To(Equal(mb.names[0])) - s := startMachine{} + s := &startMachine{} ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run() Expect(err).ToNot(HaveOccurred()) Expect(ssession).Should(Exit(0)) @@ -217,7 +217,7 @@ var _ = Describe("podman machine init", func() { Expect(err).ToNot(HaveOccurred()) 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() Expect(err).ToNot(HaveOccurred()) Expect(sshSession).To(Exit(0)) @@ -231,7 +231,7 @@ var _ = Describe("podman machine init", func() { Expect(err).ToNot(HaveOccurred()) Expect(session).To(Exit(0)) - s := startMachine{} + s := &startMachine{} ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run() Expect(err).ToNot(HaveOccurred()) Expect(ssession).Should(Exit(0)) @@ -254,7 +254,7 @@ var _ = Describe("podman machine init", func() { Expect(err).ToNot(HaveOccurred()) Expect(session).To(Exit(0)) - s := startMachine{} + s := &startMachine{} ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run() Expect(err).ToNot(HaveOccurred()) Expect(ssession).Should(Exit(0)) @@ -386,7 +386,7 @@ var _ = Describe("podman machine init", func() { Expect(err).ToNot(HaveOccurred()) Expect(session).To(Exit(0)) - s := startMachine{} + s := &startMachine{} ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run() Expect(err).ToNot(HaveOccurred()) Expect(ssession).Should(Exit(0)) @@ -437,7 +437,7 @@ var _ = Describe("podman machine init", func() { Expect(err).ToNot(HaveOccurred()) Expect(session).To(Exit(0)) - s := startMachine{} + s := &startMachine{} ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run() Expect(err).ToNot(HaveOccurred()) Expect(ssession).Should(Exit(0)) diff --git a/pkg/machine/e2e/os_test.go b/pkg/machine/e2e/os_test.go index 9fd907dde9..d15c592887 100644 --- a/pkg/machine/e2e/os_test.go +++ b/pkg/machine/e2e/os_test.go @@ -26,7 +26,7 @@ package e2e_test // Expect(err).ToNot(HaveOccurred()) // 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() // Expect(err).ToNot(HaveOccurred()) // Expect(sshSession).To(Exit(0)) diff --git a/pkg/machine/e2e/ssh_test.go b/pkg/machine/e2e/ssh_test.go index d360fd48d0..9d84079f91 100644 --- a/pkg/machine/e2e/ssh_test.go +++ b/pkg/machine/e2e/ssh_test.go @@ -11,7 +11,7 @@ var _ = Describe("podman machine ssh", func() { It("bad machine name", func() { name := randomString() - ssh := sshMachine{} + ssh := &sshMachine{} session, err := mb.setName(name).setCmd(ssh).run() Expect(err).ToNot(HaveOccurred()) Expect(session).To(Exit(125)) @@ -25,7 +25,7 @@ var _ = Describe("podman machine ssh", func() { Expect(err).ToNot(HaveOccurred()) Expect(session).To(Exit(0)) - ssh := sshMachine{} + ssh := &sshMachine{} sshSession, err := mb.setName(name).setCmd(ssh).run() Expect(err).ToNot(HaveOccurred()) Expect(sshSession.errorToString()).To(ContainSubstring("is not running")) @@ -40,7 +40,7 @@ var _ = Describe("podman machine ssh", func() { Expect(err).ToNot(HaveOccurred()) Expect(session).To(Exit(0)) - ssh := sshMachine{} + ssh := &sshMachine{} sshSession, err := mb.setName(name).setCmd(ssh.withSSHCommand([]string{"cat", "/etc/os-release"})).run() Expect(err).ToNot(HaveOccurred()) Expect(sshSession).To(Exit(0)) diff --git a/pkg/machine/e2e/start_test.go b/pkg/machine/e2e/start_test.go index d3e2c8cb34..1ee43206dd 100644 --- a/pkg/machine/e2e/start_test.go +++ b/pkg/machine/e2e/start_test.go @@ -143,7 +143,7 @@ var _ = Describe("podman machine start", func() { Expect(err).ToNot(HaveOccurred()) Expect(session2).To(Exit(0)) - s := startMachine{} + s := &startMachine{} session3, err := mb.setName(startme).setCmd(s).setTimeout(time.Minute * 10).run() Expect(err).ToNot(HaveOccurred()) Expect(session3).Should(Exit(0)) @@ -181,14 +181,14 @@ var _ = Describe("podman machine start", func() { go func() { defer GinkgoRecover() defer wg.Done() - s := startMachine{} + s := &startMachine{} startSession1, err = mb.setName(machine1).setCmd(s).setTimeout(time.Minute * 10).run() Expect(err).ToNot(HaveOccurred()) }() go func() { defer GinkgoRecover() 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 // 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 diff --git a/pkg/machine/libkrun/stubber.go b/pkg/machine/libkrun/stubber.go index 7834dda87d..1a67d6d082 100644 --- a/pkg/machine/libkrun/stubber.go +++ b/pkg/machine/libkrun/stubber.go @@ -26,7 +26,7 @@ type LibKrunStubber struct { 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.KRun = vfkit.Helper{} @@ -54,32 +54,32 @@ func (l LibKrunStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.Machine 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 } -func (l LibKrunStubber) Exists(name string) (bool, error) { +func (l *LibKrunStubber) Exists(name string) (bool, error) { // not applicable for libkrun (same as applehv) return false, nil } -func (l LibKrunStubber) MountType() vmconfigs.VolumeMountType { +func (l *LibKrunStubber) MountType() vmconfigs.VolumeMountType { 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 } -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 } -func (l LibKrunStubber) RemoveAndCleanMachines(dirs *define.MachineDirs) error { +func (l *LibKrunStubber) RemoveAndCleanMachines(dirs *define.MachineDirs) error { 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) if err != nil { return err @@ -87,15 +87,15 @@ func (l LibKrunStubber) SetProviderAttrs(mc *vmconfigs.MachineConfig, opts defin 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) } -func (l LibKrunStubber) PostStartNetworking(mc *vmconfigs.MachineConfig, noInfo bool) error { +func (l *LibKrunStubber) PostStartNetworking(mc *vmconfigs.MachineConfig, noInfo bool) error { 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 if bl == nil { 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) } -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() } -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) } -func (l LibKrunStubber) StopHostNetworking(mc *vmconfigs.MachineConfig, vmType define.VMType) error { +func (l *LibKrunStubber) StopHostNetworking(mc *vmconfigs.MachineConfig, vmType define.VMType) error { return nil } -func (l LibKrunStubber) VMType() define.VMType { +func (l *LibKrunStubber) VMType() define.VMType { return define.LibKrun } -func (l LibKrunStubber) UserModeNetworkEnabled(mc *vmconfigs.MachineConfig) bool { +func (l *LibKrunStubber) UserModeNetworkEnabled(mc *vmconfigs.MachineConfig) bool { return true } -func (l LibKrunStubber) UseProviderNetworkSetup() bool { +func (l *LibKrunStubber) UseProviderNetworkSetup() bool { return false } -func (l LibKrunStubber) RequireExclusiveActive() bool { +func (l *LibKrunStubber) RequireExclusiveActive() bool { return true } -func (l LibKrunStubber) UpdateSSHPort(mc *vmconfigs.MachineConfig, port int) error { +func (l *LibKrunStubber) UpdateSSHPort(mc *vmconfigs.MachineConfig, port int) error { return nil } -func (l LibKrunStubber) GetRosetta(mc *vmconfigs.MachineConfig) (bool, error) { +func (l *LibKrunStubber) GetRosetta(mc *vmconfigs.MachineConfig) (bool, error) { return false, nil } diff --git a/pkg/machine/qemu/stubber.go b/pkg/machine/qemu/stubber.go index 34b1ce222b..d9d657db3e 100644 --- a/pkg/machine/qemu/stubber.go +++ b/pkg/machine/qemu/stubber.go @@ -39,15 +39,15 @@ var ( gvProxyMaxBackoffAttempts = 6 ) -func (q QEMUStubber) UserModeNetworkEnabled(*vmconfigs.MachineConfig) bool { +func (q *QEMUStubber) UserModeNetworkEnabled(*vmconfigs.MachineConfig) bool { return true } -func (q QEMUStubber) UseProviderNetworkSetup() bool { +func (q *QEMUStubber) UseProviderNetworkSetup() bool { return false } -func (q QEMUStubber) RequireExclusiveActive() bool { +func (q *QEMUStubber) RequireExclusiveActive() bool { return true } diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 61fed90b64..089aaf5813 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -413,7 +413,7 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration { return p } -func (p PodmanTestIntegration) AddImageToRWStore(image string) { +func (p *PodmanTestIntegration) AddImageToRWStore(image string) { if err := p.RestoreArtifact(image); err != nil { logrus.Errorf("Unable to restore %s to RW store", image) }