Skip to content

chore: Update golangci-lint from v2.1 to v2.2 #3668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
- name: Run golangci-lint
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
with:
version: v2.1
version: v2.2
args: --verbose

security:
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ linters:
confidence: 0.6
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
rules:
- name: bare-return
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
Expand All @@ -106,6 +107,7 @@ linters:
- name: superfluous-else
- name: time-naming
- name: unexported-return
- name: unnecessary-format
- name: unreachable-code
- name: unused-parameter
- name: use-any
Expand Down
12 changes: 6 additions & 6 deletions cmd/limactl/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ func tunnelAction(cmd *cobra.Command, args []string) error {

switch runtime.GOOS {
case "darwin":
fmt.Fprintf(stdout, "Open <System Settings> → <Network> → <Wi-Fi> (or whatever) → <Details> → <Proxies> → <SOCKS proxy>,\n")
fmt.Fprintf(stdout, "and specify the following configuration:\n")
fmt.Fprintf(stdout, "- Server: 127.0.0.1\n")
fmt.Fprint(stdout, "Open <System Settings> → <Network> → <Wi-Fi> (or whatever) → <Details> → <Proxies> → <SOCKS proxy>,\n")
fmt.Fprint(stdout, "and specify the following configuration:\n")
fmt.Fprint(stdout, "- Server: 127.0.0.1\n")
fmt.Fprintf(stdout, "- Port: %d\n", port)
case "windows":
fmt.Fprintf(stdout, "Open <Settings> → <Network & Internet> → <Proxy>,\n")
fmt.Fprintf(stdout, "and specify the following configuration:\n")
fmt.Fprintf(stdout, "- Address: socks=127.0.0.1\n")
fmt.Fprint(stdout, "Open <Settings> → <Network & Internet> → <Proxy>,\n")
fmt.Fprint(stdout, "and specify the following configuration:\n")
fmt.Fprint(stdout, "- Address: socks=127.0.0.1\n")
fmt.Fprintf(stdout, "- Port: %d\n", port)
default:
fmt.Fprintf(stdout, "Set `ALL_PROXY=socks5h://127.0.0.1:%d`, etc.\n", port)
Expand Down
2 changes: 1 addition & 1 deletion pkg/guestagent/guestagent_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func comparePorts(old, neww []*api.IPPort) (added, removed []*api.IPPort) {
}
}
}
return
return added, removed
}

func (a *agent) collectEvent(ctx context.Context, st eventState) (*api.Event, eventState) {
Expand Down
9 changes: 4 additions & 5 deletions pkg/guestagent/timesync/timesync_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@ func HasRTC() (bool, error) {
return !errors.Is(err, os.ErrNotExist), err
}

func GetRTCTime() (t time.Time, err error) {
func GetRTCTime() (time.Time, error) {
f, err := os.Open(rtc)
if err != nil {
return
return time.Time{}, err
}
defer f.Close()
obj, err := unix.IoctlGetRTCTime(int(f.Fd()))
if err != nil {
return
return time.Time{}, err
}
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)
return t, nil
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
}

func SetSystemTime(t time.Time) error {
Expand Down
9 changes: 3 additions & 6 deletions pkg/hostagent/hostagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,11 @@ func writeSSHConfigFile(sshPath, instName, instDir, instSSHAddress string, sshLo
if instDir == "" {
return fmt.Errorf("directory is unknown for the instance %q", instName)
}
var b bytes.Buffer
if _, err := fmt.Fprintf(&b, `# This SSH config file can be passed to 'ssh -F'.
b := bytes.NewBufferString(`# This SSH config file can be passed to 'ssh -F'.
# This file is created by Lima, but not used by Lima itself currently.
# Modifications to this file will be lost on restarting the Lima instance.
`); err != nil {
return err
}
if err := sshutil.Format(&b, sshPath, instName, sshutil.FormatConfig,
`)
if err := sshutil.Format(b, sshPath, instName, sshutil.FormatConfig,
append(sshOpts,
fmt.Sprintf("Hostname=%s", instSSHAddress),
fmt.Sprintf("Port=%d", sshLocalPort),
Expand Down
4 changes: 2 additions & 2 deletions pkg/networks/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestUser(t *testing.T) {

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

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

cmd := config.StartCmd("shared", SocketVMNet)
Expand Down
2 changes: 1 addition & 1 deletion pkg/portfwd/control_others.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ func Control(_, _ string, c syscall.RawConn) (err error) {
if controlErr != nil {
err = controlErr
}
return
return err
}
2 changes: 1 addition & 1 deletion pkg/portfwd/control_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ func Control(_, _ string, c syscall.RawConn) (err error) {
if controlErr != nil {
err = controlErr
}
return
return err
}
2 changes: 1 addition & 1 deletion pkg/vz/network_darwin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestDialQemu(t *testing.T) {

buf := make([]byte, vmnetMaxPacketSize)

t.Logf("Receiving and verifying data packets...")
t.Log("Receiving and verifying data packets...")
for i := range packetsCount {
n, err := vzConn.Read(buf)
assert.NilError(t, err)
Expand Down
Loading