Skip to content

Commit f915900

Browse files
committed
chore: Update golangci-lint from v2.1 to v2.2
Signed-off-by: Oleksandr Redko <[email protected]>
1 parent 5bf5e51 commit f915900

File tree

10 files changed

+22
-24
lines changed

10 files changed

+22
-24
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
- name: Run golangci-lint
9292
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
9393
with:
94-
version: v2.1
94+
version: v2.2
9595
args: --verbose
9696

9797
security:

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ linters:
8181
confidence: 0.6
8282
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
8383
rules:
84+
- name: bare-return
8485
- name: blank-imports
8586
- name: context-as-argument
8687
- name: context-keys-type
@@ -106,6 +107,7 @@ linters:
106107
- name: superfluous-else
107108
- name: time-naming
108109
- name: unexported-return
110+
- name: unnecessary-format
109111
- name: unreachable-code
110112
- name: unused-parameter
111113
- name: use-any

cmd/limactl/tunnel.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ func tunnelAction(cmd *cobra.Command, args []string) error {
118118

119119
switch runtime.GOOS {
120120
case "darwin":
121-
fmt.Fprintf(stdout, "Open <System Settings> → <Network> → <Wi-Fi> (or whatever) → <Details> → <Proxies> → <SOCKS proxy>,\n")
122-
fmt.Fprintf(stdout, "and specify the following configuration:\n")
123-
fmt.Fprintf(stdout, "- Server: 127.0.0.1\n")
121+
fmt.Fprint(stdout, "Open <System Settings> → <Network> → <Wi-Fi> (or whatever) → <Details> → <Proxies> → <SOCKS proxy>,\n")
122+
fmt.Fprint(stdout, "and specify the following configuration:\n")
123+
fmt.Fprint(stdout, "- Server: 127.0.0.1\n")
124124
fmt.Fprintf(stdout, "- Port: %d\n", port)
125125
case "windows":
126-
fmt.Fprintf(stdout, "Open <Settings> → <Network & Internet> → <Proxy>,\n")
127-
fmt.Fprintf(stdout, "and specify the following configuration:\n")
128-
fmt.Fprintf(stdout, "- Address: socks=127.0.0.1\n")
126+
fmt.Fprint(stdout, "Open <Settings> → <Network & Internet> → <Proxy>,\n")
127+
fmt.Fprint(stdout, "and specify the following configuration:\n")
128+
fmt.Fprint(stdout, "- Address: socks=127.0.0.1\n")
129129
fmt.Fprintf(stdout, "- Port: %d\n", port)
130130
default:
131131
fmt.Fprintf(stdout, "Set `ALL_PROXY=socks5h://127.0.0.1:%d`, etc.\n", port)

pkg/guestagent/guestagent_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func comparePorts(old, neww []*api.IPPort) (added, removed []*api.IPPort) {
169169
}
170170
}
171171
}
172-
return
172+
return added, removed
173173
}
174174

175175
func (a *agent) collectEvent(ctx context.Context, st eventState) (*api.Event, eventState) {

pkg/guestagent/timesync/timesync_linux.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@ func HasRTC() (bool, error) {
1818
return !errors.Is(err, os.ErrNotExist), err
1919
}
2020

21-
func GetRTCTime() (t time.Time, err error) {
21+
func GetRTCTime() (time.Time, error) {
2222
f, err := os.Open(rtc)
2323
if err != nil {
24-
return
24+
return time.Time{}, err
2525
}
2626
defer f.Close()
2727
obj, err := unix.IoctlGetRTCTime(int(f.Fd()))
2828
if err != nil {
29-
return
29+
return time.Time{}, err
3030
}
31-
t = time.Date(int(obj.Year+1900), time.Month(obj.Mon+1), int(obj.Mday), int(obj.Hour), int(obj.Min), int(obj.Sec), 0, time.UTC)
32-
return t, nil
31+
return time.Date(int(obj.Year+1900), time.Month(obj.Mon+1), int(obj.Mday), int(obj.Hour), int(obj.Min), int(obj.Sec), 0, time.UTC), nil
3332
}
3433

3534
func SetSystemTime(t time.Time) error {

pkg/hostagent/hostagent.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,11 @@ func writeSSHConfigFile(sshPath, instName, instDir, instSSHAddress string, sshLo
222222
if instDir == "" {
223223
return fmt.Errorf("directory is unknown for the instance %q", instName)
224224
}
225-
var b bytes.Buffer
226-
if _, err := fmt.Fprintf(&b, `# This SSH config file can be passed to 'ssh -F'.
225+
b := bytes.NewBufferString(`# This SSH config file can be passed to 'ssh -F'.
227226
# This file is created by Lima, but not used by Lima itself currently.
228227
# Modifications to this file will be lost on restarting the Lima instance.
229-
`); err != nil {
230-
return err
231-
}
232-
if err := sshutil.Format(&b, sshPath, instName, sshutil.FormatConfig,
228+
`)
229+
if err := sshutil.Format(b, sshPath, instName, sshutil.FormatConfig,
233230
append(sshOpts,
234231
fmt.Sprintf("Hostname=%s", instSSHAddress),
235232
fmt.Sprintf("Port=%d", sshLocalPort),

pkg/networks/commands_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func TestUser(t *testing.T) {
4949

5050
t.Run("socket_vmnet", func(t *testing.T) {
5151
if ok, _ := config.IsDaemonInstalled(SocketVMNet); !ok {
52-
t.Skipf("socket_vmnet is not installed")
52+
t.Skip("socket_vmnet is not installed")
5353
}
5454
user, err := config.User(SocketVMNet)
5555
assert.NilError(t, err)
@@ -80,7 +80,7 @@ func TestStartCmd(t *testing.T) {
8080

8181
t.Run("socket_vmnet", func(t *testing.T) {
8282
if ok, _ := config.IsDaemonInstalled(SocketVMNet); !ok {
83-
t.Skipf("socket_vmnet is not installed")
83+
t.Skip("socket_vmnet is not installed")
8484
}
8585

8686
cmd := config.StartCmd("shared", SocketVMNet)

pkg/portfwd/control_others.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ func Control(_, _ string, c syscall.RawConn) (err error) {
2626
if controlErr != nil {
2727
err = controlErr
2828
}
29-
return
29+
return err
3030
}

pkg/portfwd/control_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ func Control(_, _ string, c syscall.RawConn) (err error) {
1919
if controlErr != nil {
2020
err = controlErr
2121
}
22-
return
22+
return err
2323
}

pkg/vz/network_darwin_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func TestDialQemu(t *testing.T) {
8181

8282
buf := make([]byte, vmnetMaxPacketSize)
8383

84-
t.Logf("Receiving and verifying data packets...")
84+
t.Log("Receiving and verifying data packets...")
8585
for i := range packetsCount {
8686
n, err := vzConn.Read(buf)
8787
assert.NilError(t, err)

0 commit comments

Comments
 (0)