Skip to content

Change %q in logs and errors to %#q [Part2]#5017

Open
mie313 wants to merge 1 commit into
lima-vm:masterfrom
mie313:use_hashq
Open

Change %q in logs and errors to %#q [Part2]#5017
mie313 wants to merge 1 commit into
lima-vm:masterfrom
mie313:use_hashq

Conversation

@mie313
Copy link
Copy Markdown
Contributor

@mie313 mie313 commented May 20, 2026

Change %q in logs and errors to %#q (all files in the following directories) .

  • cmd/lima-guestagent
  • pkg/apfs
  • pkg/autostart
  • pkg/cacheutil
  • pkg/cidata
  • pkg/copytool
  • pkg/downloader
  • pkg/driver
  • pkg/driverutil
  • pkg/editutil
  • pkg/envutil
  • pkg/fileutils
  • pkg/limayaml

Related issue: #4898

This PR is a continuation of the work from #4909 .

@jandubois
I also addressed your last comments in #4909 in this PR.

@mie313
Copy link
Copy Markdown
Contributor Author

mie313 commented May 20, 2026

Lints tests failed, but I am not sure how to resolve it because:

  • The error occured in files that I haven't modified in this PR.
  • The error was not reproduced when I ran golangci-lint in my local environment.

I would be grateful if you could let me know how to address them (if I should change something).

@mie313 mie313 marked this pull request as ready for review May 20, 2026 20:48
@jandubois
Copy link
Copy Markdown
Member

Please rebase on latest master branch. The lint errors are due to outdated cache entries.

@mie313 mie313 marked this pull request as draft May 21, 2026 19:04
@mie313 mie313 marked this pull request as ready for review May 21, 2026 19:26
@mie313
Copy link
Copy Markdown
Contributor Author

mie313 commented May 21, 2026

Thank you for your advice.
I rebased on latest master branch.

Copy link
Copy Markdown
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but has a few minor issues.

Comment thread pkg/driver/vz/vm_darwin.go Outdated
pidFile := filepath.Join(inst.Dir, filenames.PIDFile(*inst.Config.VMType))
if _, err := os.Stat(pidFile); !errors.Is(err, os.ErrNotExist) {
logrus.Errorf("pidfile %q already exists", pidFile)
logrus.Errorf("pidfile %#qq already exists", pidFile)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logrus.Errorf("pidfile %#qq already exists", pidFile)
logrus.Errorf("pidfile %#q already exists", pidFile)

Comment thread pkg/driver/vz/vz_driver_darwin.go Outdated

func (l *LimaVzDriver) Start(ctx context.Context) (chan error, error) {
logrus.Infof("Starting VZ (hint: to watch the boot progress, see %q)", filepath.Join(l.Instance.Dir, "serial*.log"))
logrus.Infof("Starting VZ (hint: to watch the boot progress, see %#qq)", filepath.Join(l.Instance.Dir, "serial*.log"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logrus.Infof("Starting VZ (hint: to watch the boot progress, see %#qq)", filepath.Join(l.Instance.Dir, "serial*.log"))
logrus.Infof("Starting VZ (hint: to watch the boot progress, see %#q)", filepath.Join(l.Instance.Dir, "serial*.log"))

}
if !strings.Contains(string(out), "com.apple.security.hypervisor") {
return fmt.Errorf("binary %q seems signed but lacking the \"com.apple.security.hypervisor\" entitlement", qExe)
return fmt.Errorf("binary %#q seems signed but lacking the \"com.apple.security.hypervisor\" entitlement", qExe)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use backticks everywhere?

Suggested change
return fmt.Errorf("binary %#q seems signed but lacking the \"com.apple.security.hypervisor\" entitlement", qExe)
return fmt.Errorf("binary %#q seems signed but lacking the `com.apple.security.hypervisor` entitlement", qExe)

There are more instances of \" around; I can't remember, but though we changed all of them.

Signed-off-by: mie313 <mie313.tanaka@gmail.com>
@mie313
Copy link
Copy Markdown
Contributor Author

mie313 commented May 22, 2026

Thank you for your review.
I have correced the typo (replacing %#qq with %#q) and updated the codes so that backticks are used everywhere in logs and errors.

Copy link
Copy Markdown
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@jandubois jandubois added this to the v2.1.2 milestone May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants