Skip to content

Commit 619a4ca

Browse files
committed
update golangci-lint (1.59.1)
Signed-off-by: Oleksandr Redko <[email protected]>
1 parent 188dcb5 commit 619a4ca

File tree

17 files changed

+28
-28
lines changed

17 files changed

+28
-28
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Run golangci-lint
3939
uses: golangci/[email protected]
4040
with:
41-
version: v1.55.2
41+
version: v1.59.1
4242
args: --verbose --timeout=10m
4343
- name: Run yamllint
4444
run: yamllint .

cmd/lima-guestagent/main_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func newApp() *cobra.Command {
2121
Version: strings.TrimPrefix(version.Version, "v"),
2222
}
2323
rootCmd.PersistentFlags().Bool("debug", false, "debug mode")
24-
rootCmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
24+
rootCmd.PersistentPreRunE = func(cmd *cobra.Command, _ []string) error {
2525
debug, _ := cmd.Flags().GetBool("debug")
2626
if debug {
2727
logrus.SetLevel(logrus.DebugLevel)

cmd/limactl/editflags/editflags.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func registerEdit(cmd *cobra.Command, commentPrefix string) {
2222
flags := cmd.Flags()
2323

2424
flags.Int("cpus", 0, commentPrefix+"number of CPUs") // Similar to colima's --cpu, but the flag name is slightly different (cpu vs cpus)
25-
_ = cmd.RegisterFlagCompletionFunc("cpus", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
25+
_ = cmd.RegisterFlagCompletionFunc("cpus", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
2626
var res []string
2727
for _, f := range completeCPUs(runtime.NumCPU()) {
2828
res = append(res, strconv.Itoa(f))
@@ -33,7 +33,7 @@ func registerEdit(cmd *cobra.Command, commentPrefix string) {
3333
flags.IPSlice("dns", nil, commentPrefix+"specify custom DNS (disable host resolver)") // colima-compatible
3434

3535
flags.Float32("memory", 0, commentPrefix+"memory in GiB") // colima-compatible
36-
_ = cmd.RegisterFlagCompletionFunc("memory", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
36+
_ = cmd.RegisterFlagCompletionFunc("memory", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
3737
var res []string
3838
for _, f := range completeMemoryGiB(memory.TotalMemory()) {
3939
res = append(res, fmt.Sprintf("%.1f", f))
@@ -44,15 +44,15 @@ func registerEdit(cmd *cobra.Command, commentPrefix string) {
4444
flags.StringSlice("mount", nil, commentPrefix+"directories to mount, suffix ':w' for writable (Do not specify directories that overlap with the existing mounts)") // colima-compatible
4545

4646
flags.String("mount-type", "", commentPrefix+"mount type (reverse-sshfs, 9p, virtiofs)") // Similar to colima's --mount-type=(sshfs|9p|virtiofs), but "reverse-sshfs" is Lima is called "sshfs" in colima
47-
_ = cmd.RegisterFlagCompletionFunc("mount-type", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
47+
_ = cmd.RegisterFlagCompletionFunc("mount-type", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
4848
return []string{"reverse-sshfs", "9p", "virtiofs"}, cobra.ShellCompDirectiveNoFileComp
4949
})
5050

5151
flags.Bool("mount-writable", false, commentPrefix+"make all mounts writable")
5252
flags.Bool("mount-inotify", false, commentPrefix+"enable inotify for mounts")
5353

5454
flags.StringSlice("network", nil, commentPrefix+"additional networks, e.g., \"vzNAT\" or \"lima:shared\" to assign vmnet IP")
55-
_ = cmd.RegisterFlagCompletionFunc("network", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
55+
_ = cmd.RegisterFlagCompletionFunc("network", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
5656
// TODO: retrieve the lima:* network list from networks.yaml
5757
return []string{"lima:shared", "lima:bridged", "lima:host", "lima:user-v2", "vzNAT"}, cobra.ShellCompDirectiveNoFileComp
5858
})
@@ -71,22 +71,22 @@ func RegisterCreate(cmd *cobra.Command, commentPrefix string) {
7171
flags := cmd.Flags()
7272

7373
flags.String("arch", "", commentPrefix+"machine architecture (x86_64, aarch64, riscv64)") // colima-compatible
74-
_ = cmd.RegisterFlagCompletionFunc("arch", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
74+
_ = cmd.RegisterFlagCompletionFunc("arch", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
7575
return []string{"x86_64", "aarch64", "riscv64"}, cobra.ShellCompDirectiveNoFileComp
7676
})
7777

7878
flags.String("containerd", "", commentPrefix+"containerd mode (user, system, user+system, none)")
79-
_ = cmd.RegisterFlagCompletionFunc("vm-type", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
79+
_ = cmd.RegisterFlagCompletionFunc("vm-type", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
8080
return []string{"user", "system", "user+system", "none"}, cobra.ShellCompDirectiveNoFileComp
8181
})
8282

8383
flags.Float32("disk", 0, commentPrefix+"disk size in GiB") // colima-compatible
84-
_ = cmd.RegisterFlagCompletionFunc("memory", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
84+
_ = cmd.RegisterFlagCompletionFunc("memory", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
8585
return []string{"10", "30", "50", "100", "200"}, cobra.ShellCompDirectiveNoFileComp
8686
})
8787

8888
flags.String("vm-type", "", commentPrefix+"virtual machine type (qemu, vz)") // colima-compatible
89-
_ = cmd.RegisterFlagCompletionFunc("vm-type", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
89+
_ = cmd.RegisterFlagCompletionFunc("vm-type", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
9090
return []string{"qemu", "vz"}, cobra.ShellCompDirectiveNoFileComp
9191
})
9292

cmd/limactl/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func newApp() *cobra.Command {
6363
rootCmd.PersistentFlags().Bool("debug", false, "debug mode")
6464
// TODO: "survey" does not support using cygwin terminal on windows yet
6565
rootCmd.PersistentFlags().Bool("tty", isatty.IsTerminal(os.Stdout.Fd()), "Enable TUI interactions such as opening an editor. Defaults to true when stdout is a terminal. Set to false for automation.")
66-
rootCmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
66+
rootCmd.PersistentPreRunE = func(cmd *cobra.Command, _ []string) error {
6767
l, _ := cmd.Flags().GetString("log-level")
6868
if l != "" {
6969
lvl, err := logrus.ParseLevel(l)

cmd/limactl/show_ssh.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Instead, use 'ssh -F %s/default/ssh.config lima-default' .
6666
}
6767

6868
shellCmd.Flags().StringP("format", "f", sshutil.FormatCmd, "Format: "+strings.Join(sshutil.Formats, ", "))
69-
_ = shellCmd.RegisterFlagCompletionFunc("format", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
69+
_ = shellCmd.RegisterFlagCompletionFunc("format", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
7070
return sshutil.Formats, cobra.ShellCompDirectiveNoFileComp
7171
})
7272
return shellCmd

cmd/limactl/snapshot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func newSnapshotCommand() *cobra.Command {
1515
snapshotCmd := &cobra.Command{
1616
Use: "snapshot",
1717
Short: "Manage instance snapshots",
18-
PersistentPreRun: func(cmd *cobra.Command, args []string) {
18+
PersistentPreRun: func(*cobra.Command, []string) {
1919
logrus.Warn("`limactl snapshot` is experimental")
2020
},
2121
GroupID: advancedCommand,

pkg/editutil/editutil.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func fileWarning(filename string) string {
2424
s += "# -----------\n"
2525
for _, line := range strings.Split(strings.TrimSuffix(string(b), "\n"), "\n") {
2626
s += "#"
27-
if len(line) > 0 {
27+
if line != "" {
2828
s += " " + line
2929
}
3030
s += "\n"

pkg/fsutil/fsutil_others.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
package fsutil
44

5-
func IsNFS(path string) (bool, error) {
5+
func IsNFS(string) (bool, error) {
66
return false, nil
77
}

pkg/guestagent/api/client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type GuestAgentClient struct {
1515

1616
func NewGuestAgentClient(dialFn func(ctx context.Context) (net.Conn, error)) (*GuestAgentClient, error) {
1717
opts := []grpc.DialOption{
18-
grpc.WithContextDialer(func(ctx context.Context, target string) (net.Conn, error) {
18+
grpc.WithContextDialer(func(ctx context.Context, _ string) (net.Conn, error) {
1919
return dialFn(ctx)
2020
}),
2121
grpc.WithTransportCredentials(NewCredentials()),

pkg/guestagent/kubernetesservice/kubernetesservice_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestGetPorts(t *testing.T) {
2828
kubeClient, informerFactory := newFakeKubeClient()
2929
serviceInformer := informerFactory.Core().V1().Services().Informer()
3030
_, err := serviceInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
31-
AddFunc: func(obj interface{}) { serviceCreatedCh <- struct{}{} },
31+
AddFunc: func(interface{}) { serviceCreatedCh <- struct{}{} },
3232
})
3333
assert.NilError(t, err)
3434
informerFactory.Start(ctx.Done())

0 commit comments

Comments
 (0)