17 Commits
Author SHA1 Message Date
deltron-fr 6d1ce9854f editutil: support editor command arguments
Parse editor commands with shellwords while preserving standalone paths, and add Windows path tests.

Signed-off-by: deltron-fr <kayceoogbonnaya2304@gmail.com>
2026-10-19 08:15:34 +01:00
mie313 e784721759 Change %q in logs and errors to %#q and modify bat (part2)
Signed-off-by: mie313 <mie313.tanaka@gmail.com>
2026-05-22 22:55:37 +01:00
Oleksandr Redko 94c67ba6d6 refactor: fix modernize.stringsbuilder lint issues
Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
2025-11-20 16:51:17 +02:00
Oleksandr Redko e1c00dd18d refactor: fix modernize lint issues
Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
2025-11-18 12:55:55 +02:00
Ansuman Sahoo f07bae9f62 extract common types and function from limayaml
Signed-off-by: Ansuman Sahoo <anshumansahoo500@gmail.com>
2025-08-25 15:15:33 +05:30
zyfy29 aa5a42cf71 refactor: pass through all context to avoid context.TODO() use
Signed-off-by: zyfy29 <wasuremono127@gmail.com>
2025-08-21 09:46:09 +09:00
Akihiro Suda aa817518e9 Fix noctx linter errors
```
Error: cmd/lima-guestagent/daemon_linux.go:89:29: net.Listen must not be called. use (*net.ListenConfig).Listen (noctx)
  		socketL, err := net.Listen("unix", socket)
  		                          ^
Error: cmd/lima-guestagent/install_systemd_linux.go:69:22: os/exec.Command must not be called. use os/exec.CommandContext (noctx)
  		cmd := exec.Command("systemctl", append([]string{"--system"}, args...)...)
...  		                   ^
```

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-08-19 15:31:17 +09:00
Akihiro Suda bd955e4d4c go.mod: github.com/lima-vm/lima/v2
The major version is now updated to highlight the introduction of the
pluggable VM driver framework.

See issue 3712

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-07-15 18:48:03 +09:00
Oleksandr Redko e6216df5b3 Split imports into sections: std, default, local
Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
2025-05-26 14:46:55 +03:00
Akihiro Suda fd1552da70 Add "Copyright The Lima Authors" boilterplate
The boilerplate is added for Go files, shell scripts, and Makefiles.
https://github.com/containerd/ltag is used for validating the boilerplates.

- hack/ltag: ltag templates
- .github/workflows/test.yml: ltag is executed for validation

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-03-03 10:52:45 +09:00
Oleksandr Redko e6adae66e1 Add the missing file.Close() method call
Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
2024-07-30 18:02:20 +03:00
Oleksandr Redko 619a4cad33 update golangci-lint (1.59.1)
Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
2024-06-11 12:41:26 +03:00
Norio Nomura 00ea934bd6 Use (*os.File).Write() instead of os.WriteFile()
When `os.WriteFile()` writes to an existing file, it does not apply the permissions passed as parameter. The desired permissions have already been set by `os.CreateTemp()`, so to avoid confusion, it should be changed to a writing method that does not specify permissions.

Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
2024-02-04 00:16:42 +09:00
Oleksandr Redko 5085191dbc ci: enable gofumpt, whitespace linters
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2023-10-30 12:55:32 +02:00
Akihiro Suda d329e4965b .golangci.yml: enable staticcheck
```
pkg/editutil/editutil.go:55:17: unused-parameter: parameter 'name' seems to be unused, consider removing or renaming it as _ (revive)
func OpenEditor(name string, content []byte, hdr string) ([]byte, error) {
                ^
pkg/downloader/downloader.go:480:2: if-return: redundant if ...; err != nil check, just return error instead. (revive)
        if err := os.Rename(localPathTmp, localPath); err != nil {
                return err
        }
pkg/guestagent/api/server/server.go:19:50: unused-parameter: parameter 'r' seems to be unused, consider removing or renaming it as _ (revive)
func (b *Backend) onError(w http.ResponseWriter, r *http.Request, err error, ec int) {
                                                 ^
pkg/cidata/cidata_test.go:16:19: unused-parameter: parameter 'host' seems to be unused, consider removing or renaming it as _ (revive)
func fakeLookupIP(host string) []net.IP {
                  ^
pkg/driver/driver.go:82:63: unused-parameter: parameter 'password' seems to be unused, consider removing or renaming it as _ (revive)
func (d *BaseDriver) ChangeDisplayPassword(_ context.Context, password string) error {
                                                              ^
pkg/networks/usernet/recoincile.go:86:4: if-return: redundant if ...; err != nil check, just return error instead. (revive)
                        if err := cmd.Start(); err != nil {
                                return err
                        }
pkg/networks/reconcile/reconcile.go:152:2: if-return: redundant if ...; err != nil check, just return error instead. (revive)
        if err := cmd.Start(); err != nil {
                return err
        }
pkg/qemu/qemu_driver.go:144:44: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
func (l *LimaQemuDriver) changeVNCPassword(ctx context.Context, password string) error {
                                           ^
pkg/qemu/qemu_driver.go:166:44: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
func (l *LimaQemuDriver) getVNCDisplayPort(ctx context.Context) (string, error) {
                                           ^
pkg/qemu/qemu_driver.go:269:41: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
func (l *LimaQemuDriver) DeleteSnapshot(ctx context.Context, tag string) error {
                                        ^
pkg/hostagent/api/server/server.go:17:50: unused-parameter: parameter 'r' seems to be unused, consider removing or renaming it as _ (revive)
func (b *Backend) onError(w http.ResponseWriter, r *http.Request, err error, ec int) {
                                                 ^
cmd/limactl/completion.go:8:32: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
func bashCompleteInstanceNames(cmd *cobra.Command) ([]string, cobra.ShellCompDirective) {
                               ^
cmd/limactl/edit.go:141:43: unused-parameter: parameter 'args' seems to be unused, consider removing or renaming it as _ (revive)
func editBashComplete(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
                                          ^
cmd/limactl/debug.go:64:6: empty-block: this block is empty, you can remove it (revive)
        for {
        }
cmd/limactl/snapshot.go:187:47: unused-parameter: parameter 'args' seems to be unused, consider removing or renaming it as _ (revive)
func snapshotBashComplete(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
                                              ^
cmd/limactl/factory-reset.go:25:25: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
func factoryResetAction(cmd *cobra.Command, args []string) error {
                        ^
cmd/limactl/validate.go:23:21: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
func validateAction(cmd *cobra.Command, args []string) error {
                    ^
cmd/limactl/factory-reset.go:59:51: unused-parameter: parameter 'args' seems to be unused, consider removing or renaming it as _ (revive)
func factoryResetBashComplete(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
                                                  ^
pkg/iso9660util/iso9660util.go:5:2: SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck)
        "io/ioutil"
        ^
pkg/downloader/downloader_test.go:4:2: SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck)
        "io/ioutil"
        ^
pkg/vz/vz_driver_darwin.go:174:11: SA1015: using time.Tick leaks the underlying ticker, consider using it only in endless functions, tests and the main package, and use time.NewTicker here (staticcheck)
                tick := time.Tick(500 * time.Millisecond)
                        ^
pkg/networks/usernet/client.go:33:10: SA1015: using time.Tick leaks the underlying ticker, consider using it only in endless functions, tests and the main package, and use time.NewTicker here (staticcheck)
        tick := time.Tick(500 * time.Millisecond)
                ^
pkg/vz/vm_darwin.go:88:6: SA5003: defers in this infinite loop will never run (staticcheck)
                                        defer os.RemoveAll(pidFile)
                                        ^
```

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-06-03 23:43:45 +09:00
Akihiro Suda 667349373e go.mod: drop github.com/norouter/norouter
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-05-18 10:33:13 +09:00
Akihiro Suda c65ecd8f53 cmd/limactl: split editutil (no code change)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-09-26 10:10:29 +09:00