Skip to content
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
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ linters:
# - exhaustivestruct
# - exportloopref
# - funlen
- forbidigo
# - gci
# - gochecknoglobals
# - gochecknoinits
Expand Down
2 changes: 1 addition & 1 deletion cmd/limactl/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func listAction(cmd *cobra.Command, args []string) error {
if listFields {
names := fieldNames()
sort.Strings(names)
fmt.Println(strings.Join(names, "\n"))
fmt.Fprintln(cmd.OutOrStdout(), strings.Join(names, "\n"))
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/limactl/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ func snapshotListAction(cmd *cobra.Command, args []string) error {
continue
}
tag := fields[1]
fmt.Printf("%s\n", tag)
fmt.Fprintf(cmd.OutOrStdout(), "%s\n", tag)
}
return nil
}
fmt.Print(out)
fmt.Fprint(cmd.OutOrStdout(), out)
return nil
}

Expand Down
9 changes: 5 additions & 4 deletions cmd/limactl/sudoers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"errors"
"fmt"
"io"
"runtime"

"github.com/lima-vm/lima/pkg/networks"
Expand Down Expand Up @@ -55,7 +56,7 @@ func sudoersAction(cmd *cobra.Command, args []string) error {
return err
}
if check {
return verifySudoAccess(nwCfg, args)
return verifySudoAccess(nwCfg, args, cmd.OutOrStdout())
}
switch len(args) {
case 0:
Expand All @@ -69,11 +70,11 @@ func sudoersAction(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
fmt.Print(sudoers)
fmt.Fprint(cmd.OutOrStdout(), sudoers)
return nil
}

func verifySudoAccess(nwCfg networks.Config, args []string) error {
func verifySudoAccess(nwCfg networks.Config, args []string, stdout io.Writer) error {
var file string
switch len(args) {
case 0:
Expand All @@ -90,6 +91,6 @@ func verifySudoAccess(nwCfg networks.Config, args []string) error {
if err := nwCfg.VerifySudoAccess(file); err != nil {
return err
}
fmt.Printf("%q is up-to-date (or sudo doesn't require a password)\n", file)
fmt.Fprintf(stdout, "%q is up-to-date (or sudo doesn't require a password)\n", file)
return nil
}
2 changes: 1 addition & 1 deletion pkg/instance/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ func ShowMessage(inst *store.Instance) error {
logrus.Infof("Message from the instance %q:", inst.Name)
for scanner.Scan() {
// Avoid prepending logrus "INFO" header, for ease of copy pasting
fmt.Println(scanner.Text())
fmt.Fprintln(logrus.StandardLogger().Out, scanner.Text())
}
return scanner.Err()
}
Loading