lint: reenable revive unused-parameter check

Signed-off-by: Matt Souza <medsouz99@gmail.com>
This commit is contained in:
Matt Souza
2025-09-28 19:29:42 -04:00
parent 3747e3db3f
commit 090304a054
263 changed files with 723 additions and 724 deletions

View File

@@ -25,7 +25,7 @@ func ServeIgnitionOverSock(ignitionSocket *define.VMFile, mc *vmconfigs.MachineC
return err
}
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
_, err := w.Write(ignFile)
if err != nil {
logrus.Errorf("failed to serve ignition file: %v", err)

View File

@@ -7,7 +7,7 @@ import (
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
)
func (a *AppleHVStubber) Remove(mc *vmconfigs.MachineConfig) ([]string, func() error, error) {
func (a *AppleHVStubber) Remove(_ *vmconfigs.MachineConfig) ([]string, func() error, error) {
return []string{}, func() error { return nil }, nil
}

View File

@@ -79,7 +79,7 @@ func (a *AppleHVStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.Machin
return apple.ResizeDisk(mc, mc.Resources.DiskSize)
}
func (a *AppleHVStubber) Exists(name string) (bool, error) {
func (a *AppleHVStubber) Exists(_ string) (bool, error) {
// not applicable for applehv
return false, nil
}
@@ -134,7 +134,7 @@ func (a *AppleHVStubber) StopHostNetworking(_ *vmconfigs.MachineConfig, _ define
return nil
}
func (a *AppleHVStubber) UpdateSSHPort(mc *vmconfigs.MachineConfig, port int) error {
func (a *AppleHVStubber) UpdateSSHPort(_ *vmconfigs.MachineConfig, _ int) error {
// managed by gvproxy on this backend, so nothing to do
return nil
}
@@ -147,7 +147,7 @@ func (a *AppleHVStubber) PrepareIgnition(_ *vmconfigs.MachineConfig, _ *ignition
return nil, nil
}
func (a *AppleHVStubber) PostStartNetworking(mc *vmconfigs.MachineConfig, noInfo bool) error {
func (a *AppleHVStubber) PostStartNetworking(_ *vmconfigs.MachineConfig, _ bool) error {
return nil
}

View File

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

View File

@@ -4,7 +4,7 @@ type fakeCompose struct {
cmd []string
}
func (f *fakeCompose) buildCmd(m *machineTestBuilder) []string {
func (f *fakeCompose) buildCmd(_ *machineTestBuilder) []string {
cmd := []string{"compose"}
cmd = append(cmd, "env")
f.cmd = cmd

View File

@@ -8,7 +8,7 @@ type cpMachine struct {
cmd []string
}
func (c *cpMachine) buildCmd(m *machineTestBuilder) []string {
func (c *cpMachine) buildCmd(_ *machineTestBuilder) []string {
cmd := []string{"machine", "cp"}
if c.quiet {

View File

@@ -4,7 +4,7 @@ type helpMachine struct {
cmd []string
}
func (i *helpMachine) buildCmd(m *machineTestBuilder) []string {
func (i *helpMachine) buildCmd(_ *machineTestBuilder) []string {
cmd := []string{"help"}
i.cmd = cmd
return cmd

View File

@@ -5,7 +5,7 @@ type infoMachine struct {
cmd []string
}
func (i *infoMachine) buildCmd(m *machineTestBuilder) []string {
func (i *infoMachine) buildCmd(_ *machineTestBuilder) []string {
cmd := []string{"machine", "info"}
if len(i.format) > 0 {
cmd = append(cmd, "--format", i.format)

View File

@@ -15,7 +15,7 @@ type listMachine struct {
cmd []string
}
func (i *listMachine) buildCmd(m *machineTestBuilder) []string {
func (i *listMachine) buildCmd(_ *machineTestBuilder) []string {
cmd := []string{"machine", "list"}
if len(i.format) > 0 {
cmd = append(cmd, "--format", i.format)

View File

@@ -10,7 +10,7 @@ type resetMachine struct {
cmd []string
}
func (i *resetMachine) buildCmd(m *machineTestBuilder) []string {
func (i *resetMachine) buildCmd(_ *machineTestBuilder) []string {
cmd := []string{"machine", "reset"}
if i.force {
cmd = append(cmd, "--force")

View File

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

View File

@@ -6,7 +6,7 @@ import (
"os/exec"
)
func pgrep(n string) (string, error) {
func pgrep(_ string) (string, error) {
out, err := exec.Command("pgrep", "gvproxy").Output()
return string(out), err
}

View File

@@ -28,7 +28,7 @@ type HyperVStubber struct {
vmconfigs.HyperVConfig
}
func (h HyperVStubber) UserModeNetworkEnabled(mc *vmconfigs.MachineConfig) bool {
func (h HyperVStubber) UserModeNetworkEnabled(_ *vmconfigs.MachineConfig) bool {
return true
}
@@ -40,7 +40,7 @@ func (h HyperVStubber) RequireExclusiveActive() bool {
return true
}
func (h HyperVStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.MachineConfig, builder *ignition.IgnitionBuilder) error {
func (h HyperVStubber) CreateVM(_ define.CreateVMOpts, mc *vmconfigs.MachineConfig, builder *ignition.IgnitionBuilder) error {
var (
err error
)
@@ -132,7 +132,7 @@ func (h HyperVStubber) MountType() vmconfigs.VolumeMountType {
return vmconfigs.NineP
}
func (h HyperVStubber) MountVolumesToVM(mc *vmconfigs.MachineConfig, quiet bool) error {
func (h HyperVStubber) MountVolumesToVM(_ *vmconfigs.MachineConfig, _ bool) error {
return nil
}
@@ -229,7 +229,7 @@ func (h HyperVStubber) StartVM(mc *vmconfigs.MachineConfig) (func() error, func(
// State is returns the state as a define.status. for hyperv, state differs from others because
// state is determined by the VM itself. normally this can be done with vm.State() and a conversion
// but doing here as well. this requires a little more interaction with the hypervisor
func (h HyperVStubber) State(mc *vmconfigs.MachineConfig, bypass bool) (define.Status, error) {
func (h HyperVStubber) State(mc *vmconfigs.MachineConfig, _ bool) (define.Status, error) {
_, vm, err := GetVMFromMC(mc)
if err != nil {
return define.Unknown, err
@@ -348,7 +348,7 @@ func (h HyperVStubber) SetProviderAttrs(mc *vmconfigs.MachineConfig, opts define
return nil
}
func (h HyperVStubber) PrepareIgnition(mc *vmconfigs.MachineConfig, ignBuilder *ignition.IgnitionBuilder) (*ignition.ReadyUnitOpts, error) {
func (h HyperVStubber) PrepareIgnition(mc *vmconfigs.MachineConfig, _ *ignition.IgnitionBuilder) (*ignition.ReadyUnitOpts, error) {
// HyperV is different because it has to know some ignition details before creating the VM. It cannot
// simply be derived. So we create the HyperVConfig here.
mc.HyperVHypervisor = new(vmconfigs.HyperVConfig)
@@ -365,7 +365,7 @@ func (h HyperVStubber) PrepareIgnition(mc *vmconfigs.MachineConfig, ignBuilder *
return &ignOpts, nil
}
func (h HyperVStubber) PostStartNetworking(mc *vmconfigs.MachineConfig, noInfo bool) error {
func (h HyperVStubber) PostStartNetworking(mc *vmconfigs.MachineConfig, _ bool) error {
var (
err error
executable string
@@ -441,7 +441,7 @@ func (h HyperVStubber) PostStartNetworking(mc *vmconfigs.MachineConfig, noInfo b
return err
}
func (h HyperVStubber) UpdateSSHPort(mc *vmconfigs.MachineConfig, port int) error {
func (h HyperVStubber) UpdateSSHPort(_ *vmconfigs.MachineConfig, _ int) error {
// managed by gvproxy on this backend, so nothing to do
return nil
}
@@ -548,6 +548,6 @@ func createNetworkUnit(netPort uint64) (string, error) {
return netUnit.ToString()
}
func (h HyperVStubber) GetRosetta(mc *vmconfigs.MachineConfig) (bool, error) {
func (h HyperVStubber) GetRosetta(_ *vmconfigs.MachineConfig) (bool, error) {
return false, nil
}

View File

@@ -54,11 +54,11 @@ func (l *LibKrunStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.Machin
return apple.ResizeDisk(mc, mc.Resources.DiskSize)
}
func (l *LibKrunStubber) PrepareIgnition(mc *vmconfigs.MachineConfig, ignBuilder *ignition.IgnitionBuilder) (*ignition.ReadyUnitOpts, error) {
func (l *LibKrunStubber) PrepareIgnition(_ *vmconfigs.MachineConfig, _ *ignition.IgnitionBuilder) (*ignition.ReadyUnitOpts, error) {
return nil, nil
}
func (l *LibKrunStubber) Exists(name string) (bool, error) {
func (l *LibKrunStubber) Exists(_ string) (bool, error) {
// not applicable for libkrun (same as applehv)
return false, nil
}
@@ -67,15 +67,15 @@ func (l *LibKrunStubber) MountType() vmconfigs.VolumeMountType {
return vmconfigs.VirtIOFS
}
func (l *LibKrunStubber) MountVolumesToVM(mc *vmconfigs.MachineConfig, quiet bool) error {
func (l *LibKrunStubber) MountVolumesToVM(_ *vmconfigs.MachineConfig, _ bool) error {
return nil
}
func (l *LibKrunStubber) Remove(mc *vmconfigs.MachineConfig) ([]string, func() error, error) {
func (l *LibKrunStubber) Remove(_ *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(_ *define.MachineDirs) error {
return nil
}
@@ -91,7 +91,7 @@ func (l *LibKrunStubber) StartNetworking(mc *vmconfigs.MachineConfig, cmd *gvpro
return apple.StartGenericNetworking(mc, cmd)
}
func (l *LibKrunStubber) PostStartNetworking(mc *vmconfigs.MachineConfig, noInfo bool) error {
func (l *LibKrunStubber) PostStartNetworking(_ *vmconfigs.MachineConfig, _ bool) error {
return nil
}
@@ -103,7 +103,7 @@ func (l *LibKrunStubber) StartVM(mc *vmconfigs.MachineConfig) (func() error, fun
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, _ bool) (define.Status, error) {
return mc.LibKrunHypervisor.KRun.State()
}
@@ -111,7 +111,7 @@ func (l *LibKrunStubber) StopVM(mc *vmconfigs.MachineConfig, hardStop bool) erro
return mc.LibKrunHypervisor.KRun.Stop(hardStop, true)
}
func (l *LibKrunStubber) StopHostNetworking(mc *vmconfigs.MachineConfig, vmType define.VMType) error {
func (l *LibKrunStubber) StopHostNetworking(_ *vmconfigs.MachineConfig, _ define.VMType) error {
return nil
}
@@ -119,7 +119,7 @@ func (l *LibKrunStubber) VMType() define.VMType {
return define.LibKrun
}
func (l *LibKrunStubber) UserModeNetworkEnabled(mc *vmconfigs.MachineConfig) bool {
func (l *LibKrunStubber) UserModeNetworkEnabled(_ *vmconfigs.MachineConfig) bool {
return true
}
@@ -131,10 +131,10 @@ func (l *LibKrunStubber) RequireExclusiveActive() bool {
return true
}
func (l *LibKrunStubber) UpdateSSHPort(mc *vmconfigs.MachineConfig, port int) error {
func (l *LibKrunStubber) UpdateSSHPort(_ *vmconfigs.MachineConfig, _ int) error {
return nil
}
func (l *LibKrunStubber) GetRosetta(mc *vmconfigs.MachineConfig) (bool, error) {
func (l *LibKrunStubber) GetRosetta(_ *vmconfigs.MachineConfig) (bool, error) {
return false, nil
}

View File

@@ -30,7 +30,7 @@ func GetDevNullFiles() (*os.File, *os.File, error) {
// WaitAPIAndPrintInfo prints info about the machine and does a ping test on the
// API socket
func WaitAPIAndPrintInfo(forwardState APIForwardingState, name, helper, forwardSock string, noInfo, rootful bool) {
func WaitAPIAndPrintInfo(forwardState APIForwardingState, name, helper, forwardSock string, noInfo, _ bool) {
suffix := ""
var fmtString string

View File

@@ -9,7 +9,7 @@ import (
"net"
)
func DialNamedPipe(ctx context.Context, path string) (net.Conn, error) {
func DialNamedPipe(_ context.Context, _ string) (net.Conn, error) {
return nil, errors.New("not implemented")
}

View File

@@ -21,7 +21,7 @@ type MachineOS struct {
}
// Apply applies the image by sshing into the machine and running apply from inside the VM.
func (m *MachineOS) Apply(image string, opts ApplyOptions) error {
func (m *MachineOS) Apply(image string, _ ApplyOptions) error {
args := []string{"podman", "machine", "os", "apply", image}
if err := machine.LocalhostSSH(m.VM.SSH.RemoteUsername, m.VM.SSH.IdentityPath, m.VMName, m.VM.SSH.Port, args); err != nil {

View File

@@ -35,7 +35,7 @@ type OSTree struct {
// rpm-ostree needs to be run as root. If a user wants to use an image in containers-storage,
// rpm-ostree will look at the root storage, and not the user storage, which is unexpected behavior.
// Exporting to an oci-dir works around this, without nagging the user to configure the machine in rootful mode.
func (dist *OSTree) Apply(image string, opts ApplyOptions) error {
func (dist *OSTree) Apply(image string, _ ApplyOptions) error {
imageWithTransport := image
transport := alltransports.TransportFromImageName(image)

View File

@@ -9,7 +9,7 @@ import (
func getPortCheckListenConfig() *net.ListenConfig {
return &net.ListenConfig{
Control: func(network, address string, c syscall.RawConn) (cerr error) {
Control: func(_, _ string, c syscall.RawConn) (cerr error) {
if err := c.Control(func(fd uintptr) {
// Prevent listening socket from holding over in TIME_WAIT in the rare case a connection
// attempt occurs in the short window the socket is listening. This ensures the registration

View File

@@ -9,7 +9,7 @@ import (
// implementations require a different cast (Handle on Windows, int on Unixes)
func getPortCheckListenConfig() *net.ListenConfig {
return &net.ListenConfig{
Control: func(network, address string, c syscall.RawConn) (cerr error) {
Control: func(_, _ string, c syscall.RawConn) (cerr error) {
if err := c.Control(func(fd uintptr) {
// Prevent listening socket from holding over in TIME_WAIT in the rare case a connection
// attempt occurs in the short window the socket is listening. This ensures the registration

View File

@@ -243,7 +243,7 @@ func (q *QEMUStubber) Remove(mc *vmconfigs.MachineConfig) ([]string, func() erro
}, nil
}
func (q *QEMUStubber) State(mc *vmconfigs.MachineConfig, bypass bool) (define.Status, error) {
func (q *QEMUStubber) State(mc *vmconfigs.MachineConfig, _ bool) (define.Status, error) {
// Check if qmp socket path exists
if err := fileutils.Exists(mc.QEMUHypervisor.QMPMonitor.Address.GetPath()); errors.Is(err, fs.ErrNotExist) {
return define.Stopped, nil

View File

@@ -25,10 +25,10 @@ func checkProcessStatus(processHint string, pid int, stderrBuf *bytes.Buffer) er
return nil
}
func sigKill(pid int) error {
func sigKill(_ int) error {
return nil
}
func findProcess(pid int) (int, error) {
func findProcess(_ int) (int, error) {
return -1, nil
}

View File

@@ -89,7 +89,7 @@ func (q *QEMUStubber) setQEMUCommandLine(mc *vmconfigs.MachineConfig) error {
return nil
}
func (q *QEMUStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.MachineConfig, builder *ignition.IgnitionBuilder) error {
func (q *QEMUStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.MachineConfig, _ *ignition.IgnitionBuilder) error {
monitor, err := command.NewQMPMonitor(opts.Name, opts.Dirs.RuntimeDir)
if err != nil {
return err
@@ -243,7 +243,7 @@ func waitForReady(readySocket *define.VMFile, pid int, stdErrBuffer *bytes.Buffe
return err
}
func (q *QEMUStubber) Exists(name string) (bool, error) {
func (q *QEMUStubber) Exists(_ string) (bool, error) {
return false, nil
}
@@ -380,15 +380,15 @@ func (q *QEMUStubber) MountType() vmconfigs.VolumeMountType {
return vmconfigs.VirtIOFS
}
func (q *QEMUStubber) PostStartNetworking(mc *vmconfigs.MachineConfig, noInfo bool) error {
func (q *QEMUStubber) PostStartNetworking(_ *vmconfigs.MachineConfig, _ bool) error {
return nil
}
func (q *QEMUStubber) UpdateSSHPort(mc *vmconfigs.MachineConfig, port int) error {
func (q *QEMUStubber) UpdateSSHPort(_ *vmconfigs.MachineConfig, _ int) error {
// managed by gvproxy on this backend, so nothing to do
return nil
}
func (q *QEMUStubber) GetRosetta(mc *vmconfigs.MachineConfig) (bool, error) {
func (q *QEMUStubber) GetRosetta(_ *vmconfigs.MachineConfig) (bool, error) {
return false, nil
}

View File

@@ -753,7 +753,7 @@ func confirmationMessage(files []string) {
}
}
func Reset(mps []vmconfigs.VMProvider, opts machine.ResetOptions) error {
func Reset(mps []vmconfigs.VMProvider, _ machine.ResetOptions) error {
var resetErrors *multierror.Error
removeDirs := []*machineDefine.MachineDirs{}

View File

@@ -10,7 +10,7 @@ import (
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
)
func setupMachineSockets(mc *vmconfigs.MachineConfig, dirs *define.MachineDirs) ([]string, string, machine.APIForwardingState, error) {
func setupMachineSockets(mc *vmconfigs.MachineConfig, _ *define.MachineDirs) ([]string, string, machine.APIForwardingState, error) {
machinePipe := env.WithPodmanPrefix(mc.Name)
if !machine.PipeNameAvailable(machinePipe, machine.MachineNameWait) {
return nil, "", 0, fmt.Errorf("could not start api proxy since expected pipe is not available: %s", machinePipe)

View File

@@ -8,7 +8,7 @@ import (
"os/exec"
)
func setupIOPassthrough(cmd *exec.Cmd, interactive bool, stdin io.Reader) error {
func setupIOPassthrough(cmd *exec.Cmd, _ bool, stdin io.Reader) error {
cmd.Stdin = stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

View File

@@ -299,7 +299,7 @@ func (mc *MachineConfig) IsFirstBoot() bool {
return mc.LastUp.IsZero()
}
func (mc *MachineConfig) ConnectionInfo(vmtype define.VMType) (*define.VMFile, *define.VMFile, error) {
func (mc *MachineConfig) ConnectionInfo(_ define.VMType) (*define.VMFile, *define.VMFile, error) {
socket, err := mc.APISocket()
return socket, getPipe(mc.Name), err
}
@@ -352,7 +352,7 @@ func loadMachineFromFQPath(path *define.VMFile) (*MachineConfig, error) {
// LoadMachinesInDir returns all the machineconfigs located in given dir
func LoadMachinesInDir(dirs *define.MachineDirs) (map[string]*MachineConfig, error) {
mcs := make(map[string]*MachineConfig)
if err := filepath.WalkDir(dirs.ConfigDir.GetPath(), func(path string, d fs.DirEntry, err error) error {
if err := filepath.WalkDir(dirs.ConfigDir.GetPath(), func(_ string, d fs.DirEntry, _ error) error {
if strings.HasSuffix(d.Name(), ".json") {
fullPath, err := dirs.ConfigDir.AppendToNewVMFile(d.Name(), nil)
if err != nil {

View File

@@ -6,6 +6,6 @@ import (
"github.com/containers/podman/v5/pkg/machine/define"
)
func getPipe(name string) *define.VMFile {
func getPipe(_ string) *define.VMFile {
return nil
}

View File

@@ -99,7 +99,7 @@ func (w WSLStubber) MountType() vmconfigs.VolumeMountType {
return vmconfigs.Unknown
}
func (w WSLStubber) MountVolumesToVM(mc *vmconfigs.MachineConfig, quiet bool) error {
func (w WSLStubber) MountVolumesToVM(_ *vmconfigs.MachineConfig, _ bool) error {
return nil
}
@@ -169,7 +169,7 @@ func (w WSLStubber) SetProviderAttrs(mc *vmconfigs.MachineConfig, opts define.Se
return nil
}
func (w WSLStubber) StartNetworking(mc *vmconfigs.MachineConfig, cmd *gvproxy.GvproxyCommand) error {
func (w WSLStubber) StartNetworking(mc *vmconfigs.MachineConfig, _ *gvproxy.GvproxyCommand) error {
// Startup user-mode networking if enabled
if mc.WSLHypervisor.UserModeNetworking {
return startUserModeNetworking(mc)
@@ -223,7 +223,7 @@ func (w WSLStubber) StartVM(mc *vmconfigs.MachineConfig) (func() error, func() e
return nil, readyFunc, err
}
func (w WSLStubber) State(mc *vmconfigs.MachineConfig, bypass bool) (define.Status, error) {
func (w WSLStubber) State(mc *vmconfigs.MachineConfig, _ bool) (define.Status, error) {
running, err := isRunning(mc.Name)
if err != nil {
return "", err
@@ -234,7 +234,7 @@ func (w WSLStubber) State(mc *vmconfigs.MachineConfig, bypass bool) (define.Stat
return define.Stopped, nil
}
func (w WSLStubber) StopVM(mc *vmconfigs.MachineConfig, hardStop bool) error {
func (w WSLStubber) StopVM(mc *vmconfigs.MachineConfig, _ bool) error {
var (
err error
)
@@ -276,7 +276,7 @@ func (w WSLStubber) StopVM(mc *vmconfigs.MachineConfig, hardStop bool) error {
return terminateDist(dist)
}
func (w WSLStubber) StopHostNetworking(mc *vmconfigs.MachineConfig, vmType define.VMType) error {
func (w WSLStubber) StopHostNetworking(mc *vmconfigs.MachineConfig, _ define.VMType) error {
return stopUserModeNetworking(mc)
}
@@ -294,6 +294,6 @@ func (w WSLStubber) VMType() define.VMType {
return define.WSLVirt
}
func (w WSLStubber) GetRosetta(mc *vmconfigs.MachineConfig) (bool, error) {
func (w WSLStubber) GetRosetta(_ *vmconfigs.MachineConfig) (bool, error) {
return false, nil
}