Skip to content

refactor: Avoid os.Getenv duplication #3683

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

Conversation

alexandear
Copy link
Member

@alexandear alexandear commented Jul 3, 2025

The PR simplifies code.

@alexandear alexandear requested a review from Copilot July 3, 2025 17:08
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors environment variable parsing to avoid redundant calls to os.Getenv in boolean flag checks.

  • Reuses the already fetched envVar when parsing instead of calling os.Getenv again.
  • Applies this change in both the QEMU command-line builder and the hostagent event processor.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
pkg/qemu/qemu.go Use envVar directly in strconv.ParseBool call
pkg/hostagent/hostagent.go Use envVar directly in strconv.ParseBool call

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda AkihiroSuda added this to the v1.2.0 milestone Jul 3, 2025
@AkihiroSuda AkihiroSuda merged commit 8b30287 into lima-vm:master Jul 3, 2025
36 checks passed
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