Skip to content

Commit cd8734a

Browse files
authored
Merge pull request #1604 from AkihiroSuda/dev
.golangci.yml: enable staticcheck
2 parents c0334c5 + d329e49 commit cd8734a

40 files changed

+80
-90
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Run golangci-lint
2323
uses: golangci/[email protected]
2424
with:
25-
version: v1.51.1
25+
version: v1.53.1
2626
args: --verbose
2727
- name: Run yamllint
2828
run: yamllint .

.golangci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ run:
2222
linters:
2323
disable-all: true
2424
enable:
25-
- depguard
25+
# - depguard # annoying since golangci-lint v1.53.1 https://github.com/golangci/golangci-lint/issues/3877
2626
- gofmt
2727
- goimports
2828
- govet
@@ -69,7 +69,7 @@ linters:
6969
# - rowserrcheck
7070
# - scopelint
7171
# - sqlclosecheck
72-
# - staticcheck
72+
- staticcheck
7373
# - stylecheck
7474
# - testpackage
7575
# - tparallel

cmd/lima-guestagent/daemon_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func newDaemonCommand() *cobra.Command {
2424
return daemonCommand
2525
}
2626

27-
func daemonAction(cmd *cobra.Command, args []string) error {
27+
func daemonAction(cmd *cobra.Command, _ []string) error {
2828
socket := "/run/lima-guestagent.sock"
2929
tick, err := cmd.Flags().GetDuration("tick")
3030
if err != nil {

cmd/lima-guestagent/install_systemd_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func newInstallSystemdCommand() *cobra.Command {
2222
return installSystemdCommand
2323
}
2424

25-
func installSystemdAction(cmd *cobra.Command, args []string) error {
25+
func installSystemdAction(_ *cobra.Command, _ []string) error {
2626
unit, err := generateSystemdUnit()
2727
if err != nil {
2828
return err

cmd/limactl/completion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/spf13/cobra"
66
)
77

8-
func bashCompleteInstanceNames(cmd *cobra.Command) ([]string, cobra.ShellCompDirective) {
8+
func bashCompleteInstanceNames(_ *cobra.Command) ([]string, cobra.ShellCompDirective) {
99
instances, err := store.Instances()
1010
if err != nil {
1111
return nil, cobra.ShellCompDirectiveDefault

cmd/limactl/debug.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"strconv"
5+
"time"
56

67
"github.com/lima-vm/lima/pkg/hostagent/dns"
78
"github.com/sirupsen/logrus"
@@ -62,5 +63,6 @@ func debugDNSAction(cmd *cobra.Command, args []string) error {
6263
}
6364
logrus.Infof("Started srv %+v (UDP %d, TCP %d)", srv, udpLocalPort, tcpLocalPort)
6465
for {
66+
time.Sleep(time.Hour)
6567
}
6668
}

cmd/limactl/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ func deleteInstance(inst *store.Instance, force bool) error {
5959
return nil
6060
}
6161

62-
func deleteBashComplete(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
62+
func deleteBashComplete(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
6363
return bashCompleteInstanceNames(cmd)
6464
}

cmd/limactl/disk.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func diskCreateAction(cmd *cobra.Command, args []string) error {
9797
}
9898

9999
if err := qemu.CreateDataDisk(diskDir, format, int(diskSize)); err != nil {
100-
return err
100+
return fmt.Errorf("Failed to create %s disk in %q", format, diskDir)
101101
}
102102

103103
return nil
@@ -297,7 +297,7 @@ $ limactl disk unlock DISK1 DISK2 ...
297297
return diskUnlockCommand
298298
}
299299

300-
func diskUnlockAction(cmd *cobra.Command, args []string) error {
300+
func diskUnlockAction(_ *cobra.Command, args []string) error {
301301
for _, diskName := range args {
302302
disk, err := store.InspectDisk(diskName)
303303
if err != nil {

cmd/limactl/edit.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func editAction(cmd *cobra.Command, args []string) error {
7777
hdr += "# and an empty file will abort the edit.\n"
7878
hdr += "\n"
7979
hdr += editutil.GenerateEditorWarningHeader()
80-
yBytes, err = editutil.OpenEditor(instName, yContent, hdr)
80+
yBytes, err = editutil.OpenEditor(yContent, hdr)
8181
if err != nil {
8282
return err
8383
}
@@ -138,6 +138,6 @@ func askWhetherToStart() (bool, error) {
138138
return ans, nil
139139
}
140140

141-
func editBashComplete(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
141+
func editBashComplete(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
142142
return bashCompleteInstanceNames(cmd)
143143
}

cmd/limactl/factory-reset.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func newFactoryResetCommand() *cobra.Command {
2222
return resetCommand
2323
}
2424

25-
func factoryResetAction(cmd *cobra.Command, args []string) error {
25+
func factoryResetAction(_ *cobra.Command, args []string) error {
2626
instName := DefaultInstanceName
2727
if len(args) > 0 {
2828
instName = args[0]
@@ -56,6 +56,6 @@ func factoryResetAction(cmd *cobra.Command, args []string) error {
5656
return nil
5757
}
5858

59-
func factoryResetBashComplete(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
59+
func factoryResetBashComplete(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
6060
return bashCompleteInstanceNames(cmd)
6161
}

0 commit comments

Comments
 (0)