Skip to content

Commit 355d72a

Browse files
authored
Merge pull request #2014 from alexandear/cmd-avoid-global-vars
limactl,guestagent: Remove global variables
2 parents a21b5f3 + e88ffc7 commit 355d72a

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

cmd/lima-guestagent/daemon_linux.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ func newDaemonCommand() *cobra.Command {
2828
return daemonCommand
2929
}
3030

31-
var (
32-
vSockPort = 0
33-
34-
virtioPort = "/dev/virtio-ports/" + filenames.VirtioPort
35-
)
36-
3731
func daemonAction(cmd *cobra.Command, _ []string) error {
3832
tick, err := cmd.Flags().GetDuration("tick")
3933
if err != nil {
@@ -43,6 +37,7 @@ func daemonAction(cmd *cobra.Command, _ []string) error {
4337
if err != nil {
4438
return err
4539
}
40+
vSockPort := 0
4641
if vSockPortOverride != 0 {
4742
vSockPort = vSockPortOverride
4843
}
@@ -74,6 +69,7 @@ func daemonAction(cmd *cobra.Command, _ []string) error {
7469
srv := &http.Server{Handler: r}
7570

7671
var l net.Listener
72+
virtioPort := "/dev/virtio-ports/" + filenames.VirtioPort
7773
if _, err := os.Stat(virtioPort); err == nil {
7874
qemuL, err := serialport.Listen(virtioPort)
7975
if err != nil {

cmd/limactl/copy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/spf13/cobra"
1616
)
1717

18-
var copyHelp = `Copy files between host and guest
18+
const copyHelp = `Copy files between host and guest
1919
2020
Prefix guest filenames with the instance name and a colon.
2121

cmd/limactl/shell.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
// in place of the 'ssh' executable.
2222
const envShellSSH = "SSH"
2323

24-
var shellHelp = `Execute shell in Lima
24+
const shellHelp = `Execute shell in Lima
2525
2626
lima command is provided as an alias for limactl shell $LIMA_INSTANCE. $LIMA_INSTANCE defaults to "` + DefaultInstanceName + `".
2727

0 commit comments

Comments
 (0)