Skip to content

Commit

Permalink
lint: Fix 'unused-parameter' errors
Browse files Browse the repository at this point in the history
GOOS=darwin "/home/teuf/redhat/crc/crc/tools/bin"/golangci-lint run
pkg/drivers/none/driver.go:53:34: unused-parameter: parameter 'rawData' seems to be unused, consider removing or renaming it as _ (revive)
func (d *Driver) UpdateConfigRaw(rawData []byte) error {
                                 ^
  • Loading branch information
cfergeau authored and praveenkumar committed Aug 4, 2023
1 parent 9c2b5c4 commit 651d51f
Show file tree
Hide file tree
Showing 20 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion cmd/crc/cmd/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var ipCmd = &cobra.Command{
},
}

func runIP(arguments []string) error {
func runIP(_ []string) error {
client := newMachine()
if err := checkIfMachineMissing(client); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/crc/cmd/oc_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var ocEnvCmd = &cobra.Command{
},
}

func runOcEnv(args []string) error {
func runOcEnv(_ []string) error {
userShell, err := shell.GetShell(forceShell)
if err != nil {
return fmt.Errorf("Error running the oc-env command: %s", err.Error())
Expand Down
2 changes: 1 addition & 1 deletion cmd/crc/cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var setupCmd = &cobra.Command{
},
}

func runSetup(arguments []string) error {
func runSetup(_ []string) error {
if config.Get(crcConfig.ConsentTelemetry).AsString() == "" {
fmt.Println("CRC is constantly improving and we would like to know more about usage (more details at https://developers.redhat.com/article/tool-data-collection)")
fmt.Println("Your preference can be changed manually if desired using 'crc config set consent-telemetry <yes/no>'")
Expand Down
2 changes: 1 addition & 1 deletion pkg/crc/cluster/clusteroperator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type mockLister struct {
file string
}

func (r *mockLister) List(ctx context.Context, opts metav1.ListOptions) (*v1.ClusterOperatorList, error) {
func (r *mockLister) List(_ context.Context, _ metav1.ListOptions) (*v1.ClusterOperatorList, error) {
bin, err := os.ReadFile(r.file)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/crc/machine/driver_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ func updateKernelArgs(vm *virtualMachine) error {
return vm.api.Save(vm.Host)
}

func updateDriverStruct(host *host.Host, driver *machineVf.Driver) error {
func updateDriverStruct(_ *host.Host, _ *machineVf.Driver) error {
return drivers.ErrNotImplemented
}
4 changes: 2 additions & 2 deletions pkg/crc/machine/driver_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func updateDriverConfig(host *host.Host, driver *machineLibvirt.Driver) error {
return host.UpdateConfig(driverData)
}

func updateKernelArgs(vm *virtualMachine) error {
func updateKernelArgs(_ *virtualMachine) error {
return nil
}

Expand All @@ -49,6 +49,6 @@ func (r *RPCServerDriver) SetConfigRaw(data []byte, _ *struct{}) error {
}
*/

func updateDriverStruct(host *host.Host, driver *machineLibvirt.Driver) error {
func updateDriverStruct(_ *host.Host, _ *machineLibvirt.Driver) error {
return drivers.ErrNotImplemented
}
2 changes: 1 addition & 1 deletion pkg/crc/machine/driver_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func updateDriverConfig(host *host.Host, driver *machineHyperv.Driver) error {
return host.UpdateConfig(driverData)
}

func updateKernelArgs(vm *virtualMachine) error {
func updateKernelArgs(_ *virtualMachine) error {
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/crc/machine/fakemachine/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (c *Client) GetConsoleURL() (*types.ConsoleResult, error) {
}, nil
}

func (c *Client) GetProxyConfig(machineName string) (*httpproxy.ProxyConfig, error) {
func (c *Client) GetProxyConfig(_ string) (*httpproxy.ProxyConfig, error) {
return nil, errors.New("not implemented")
}

Expand All @@ -70,14 +70,14 @@ func (c *Client) PowerOff() error {
return nil
}

func (c *Client) GenerateBundle(forceStop bool) error {
func (c *Client) GenerateBundle(_ bool) error {
if c.Failing {
return errors.New("bundle generation failed")
}
return nil
}

func (c *Client) Start(ctx context.Context, startConfig types.StartConfig) (*types.StartResult, error) {
func (c *Client) Start(_ context.Context, _ types.StartConfig) (*types.StartResult, error) {
if c.Failing {
return nil, errors.New("Failed to start")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/crc/machine/generate_bundle_nonlinux.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import (
"runtime"
)

func copyDiskImage(dirName string) (string, string, error) {
func copyDiskImage(_ string) (string, string, error) {
return "", "", fmt.Errorf("Not implemented for %s", runtime.GOOS)
}
2 changes: 1 addition & 1 deletion pkg/crc/machine/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (m *waitingMachine) Stop() (state.State, error) {
return state.Stopped, nil
}

func (m *waitingMachine) GenerateBundle(forceStop bool) error {
func (m *waitingMachine) GenerateBundle(_ bool) error {
return errors.New("not implemented")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/crc/preflight/preflight_checks_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var nonWinPreflightChecks = []Check{
},
}

func genericPreflightChecks(preset crcpreset.Preset) []Check {
func genericPreflightChecks(_ crcpreset.Preset) []Check {
return []Check{
{
configKeySuffix: "check-admin-helper-cached",
Expand Down
2 changes: 1 addition & 1 deletion pkg/crc/preflight/preflight_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func getAllPreflightChecks() []Check {
return getPreflightChecks(true, network.SystemNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift)
}

func getChecks(mode network.Mode, bundlePath string, preset crcpreset.Preset) []Check {
func getChecks(_ network.Mode, bundlePath string, preset crcpreset.Preset) []Check {
checks := []Check{}

checks = append(checks, nonWinPreflightChecks...)
Expand Down
2 changes: 1 addition & 1 deletion pkg/crc/systemd/systemd.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (userRunner *systemctlUserRunner) RunPrivate(command string, args ...string
return userRunner.runner.RunPrivate("systemctl", append([]string{"--user"}, args...)...)
}

func (userRunner *systemctlUserRunner) RunPrivileged(reason string, cmdAndArgs ...string) (string, string, error) {
func (userRunner *systemctlUserRunner) RunPrivileged(_ string, cmdAndArgs ...string) (string, string, error) {
command := cmdAndArgs[0]
args := cmdAndArgs[1:]
if command != "systemctl" {
Expand Down
4 changes: 2 additions & 2 deletions pkg/crc/systemd/systemd_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ func (r *mockSystemdRunner) Run(command string, args ...string) (string, string,
}
}

func (r *mockSystemdRunner) RunPrivate(command string, args ...string) (string, string, error) {
func (r *mockSystemdRunner) RunPrivate(_ string, _ ...string) (string, string, error) {
r.test.FailNow()
return "", "", fmt.Errorf("Unexpected RunPrivate() call")
}

func (r *mockSystemdRunner) RunPrivileged(reason string, cmdAndArgs ...string) (string, string, error) {
func (r *mockSystemdRunner) RunPrivileged(_ string, cmdAndArgs ...string) (string, string, error) {
privilegedCommands := []string{
"start",
"stop",
Expand Down
2 changes: 1 addition & 1 deletion pkg/crc/tray/util_linux.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package tray

// ValidateTrayAutostart checks tray-auto-start is used in macOS and its a bool
func ValidateTrayAutostart(value interface{}) (bool, string) {
func ValidateTrayAutostart(_ interface{}) (bool, string) {
return false, "Not supported on Linux"
}
2 changes: 1 addition & 1 deletion pkg/crc/tray/util_windows.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package tray

// ValidateTrayAutostart checks tray-auto-start is used in macOS and its a bool
func ValidateTrayAutostart(value interface{}) (bool, string) {
func ValidateTrayAutostart(_ interface{}) (bool, string) {
return false, "Not supported on Windows"
}
2 changes: 1 addition & 1 deletion pkg/drivers/none/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (d *Driver) Remove() error {
return nil
}

func (d *Driver) UpdateConfigRaw(rawData []byte) error {
func (d *Driver) UpdateConfigRaw(_ []byte) error {
return fmt.Errorf("hosts without a driver cannot be updated")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/libmachine/load_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/crc-org/crc/pkg/libmachine/host"
)

func (api *Client) NewHost(driverName string, driverPath string, rawDriver []byte) (*host.Host, error) {
func (api *Client) NewHost(_ string, driverPath string, rawDriver []byte) (*host.Host, error) {
driver := vfkit.NewDriver("", "")
if err := json.Unmarshal(rawDriver, &driver); err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/libmachine/load_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/crc-org/crc/pkg/libmachine/host"
)

func (api *Client) NewHost(driverName string, driverPath string, rawDriver []byte) (*host.Host, error) {
func (api *Client) NewHost(_ string, driverPath string, rawDriver []byte) (*host.Host, error) {
driver := hyperv.NewDriver("", "")
if err := json.Unmarshal(rawDriver, &driver); err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func init() {
testsuite.ParseFlags()
}

func TestMain(m *testing.M) {
func TestMain(_ *testing.M) {

pflag.Parse()
testsuite.GodogTags = opts.Tags
Expand Down

0 comments on commit 651d51f

Please sign in to comment.