crc
crc copied to clipboard
build: add macos-precheck make path
Changes:
- Adds
macos-precheckmake path to make sure that dependencies for mac builds are checked-for.
Build process improvements:
- Added
macos-prechecktarget: Introduced a new target in theMakefileto verify the presence ofpkg-configon macOS systems. Ifpkg-configis missing, the build process will terminate with an error message instructing the user to install it using Homebrew. - Updated
.PHONYdeclarations: Included the newmacos-prechecktarget in the.PHONYsection to ensure it is treated as a non-file target.
Reviewer's Guide
Introduces a vet target in the Makefile with Darwin-specific exclusions and uses Go build tags plus a stub implementation to ensure libvirt packages compile on non-Linux platforms, enabling static analysis across macOS.
Class diagram for libvirt templates stub implementation (non-Linux)
classDiagram
class NetworkConfig {
}
class MachineDriverDownloadURL {
<<constant>>
value = ""
}
Flow diagram for Makefile 'vet' target with OS-specific logic
flowchart TD
Start([Start 'make vet'])
OS{Is GOOS=darwin?}
Start --> OS
OS -- Yes --> Exclude[Run 'go vet' excluding /libvirt]
OS -- No --> All[Run 'go vet' on all packages]
Exclude --> End([End])
All --> End
File-Level Changes
| Change | Details | Files |
|---|---|---|
Introduce vet Makefile target with OS-specific exclusions |
|
Makefile |
| Apply build tags to libvirt Linux-specific sources |
|
|
| Provide stub libvirt implementation for non-Linux builds |
|
pkg/crc/machine/libvirt/templates_stub.go |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull request title to generate a title at any time. You can also comment@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment@sourcery-ai summaryon the pull request to (re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment@sourcery-ai reviewto trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
- Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
Hi @sebrandon1. Thanks for your PR.
I'm waiting for a crc-org member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
I understand the commands that are listed here.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign evidolob for approval. For more information see the Code Review Process.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
What are you trying to achieve? If your goal is to run go vet on the crc codebase, this is already done through golangci-lint, govet is enabled by defaut. This works cross-platform somehow without the need for pkg-config on macos. I ran this on my mac after adding a bogus printf to driver_linux.go:
% make cross-lint
GOARCH=amd64 GOOS=darwin "/Users/teuf/dev/crc/tools/bin"/golangci-lint run
0 issues.
GOARCH=arm64 GOOS=darwin "/Users/teuf/dev/crc/tools/bin"/golangci-lint run
0 issues.
GOARCH=amd64 GOOS=linux "/Users/teuf/dev/crc/tools/bin"/golangci-lint run
pkg/crc/machine/libvirt/driver_linux.go:14:25: printf: fmt.Printf format %d reads arg #1, but call has 0 args (govet)
fmt.Printf("vet error: %d")
^
1 issues:
* govet: 1
@cfergeau My goal was to be without running the entire GolangCI suite every time I wanted to vet my code locally. I just find it to be a useful development tool to fire off go vet when putting together some code as its free with Go. In its current state make vet doesn't run during the CI runs as far as I can tell so it doesn't change the GolangCI staticcheck integration.
Walkthrough
A new phony target, macos-precheck, was added to the Makefile to verify the presence of pkg-config on macOS systems when GOOS is set to darwin. The .PHONY declaration was updated to include this new target. No other build logic or dependencies were changed.
Changes
| File | Change Summary |
|---|---|
| Makefile | Added macos-precheck phony target to check for pkg-config on macOS; updated .PHONY targets. |
Poem
A bunny hopped to Mac’s domain,
Checking tools before the train.
“Is pkg-config here?” it cried—
If not, Homebrew must be supplied!
Now builds on Mac are sure to go,
Thanks to checks before the show.
🐇✨
📜 Recent review details
Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 47be8d03134694b9580c96dfd319594f8ce1e1c4 and 3fbed1ad64d86bed9ee53af599783d25d13b8203.
📒 Files selected for processing (1)
Makefile(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: build-qe (darwin, amd64)
- GitHub Check: build (windows-2022, 1.23)
- GitHub Check: build (ubuntu-latest, 1.23)
🔇 Additional comments (2)
Makefile (2)
112-113: No objections to the .PHONY updateAdding
macos-precheckto the phony list is correct and prevents make from confusing the target with a file of the same name.
419-423: ```shell #!/bin/bash grep -R "GOOS" -n Makefile</details> </blockquote></details> </details> <!-- internal state start --> <!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIBbHgvWi40WnpmNCZEMF5RWFEAa0h0/I9ualhoyDlIbERKexIBKgxafAwARhQMXApFbAZpdEhyAHcw51JQ+CxcPJ5ekTEAcmQAWTQSgDMEjwIUZl58K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oMQenZ0hKBtlhR5XhbTWUbEhY01YU1npuNSTqMkKBFv8vREOa72DZl+QYKAEaogwraIO3NV66xRq4IWYsZZyxcGRc2gpsIv2PNSFEUc5LJigeg5WtEWosCwgBTsa6/qFAtGzLmXwK6117AKdBfydKAZatJoSgAFLCEVTwAC8CqlWwgAJQ3LuV+45pyakOS+XMl5zTlksO6GstAGzHBbPkNUJgSg9lqAOeMgTkyFCsHUAAfXgFCHTYEiSD1oDpqMj6jknM0wAZk2LZWg7QUgADYAAstAAAcTn7MAE4uIAFZrNoE2H57z3mADs7nrO0AAEx+Yc9ZgQ7nosAAZrOWcE1p+0uA9MGaM+bOgOnan6CAA= --> <!-- internal state end --> <!-- tips_start --> --- <details> <summary>🪧 Tips</summary> ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=crc-org/crc&utm_content=4793): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit <commit_id>, please review it.` - `Explain this complex logic.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai explain this code block.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and explain its main purpose.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` ### Support Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR. - `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements. </details> <!-- tips_end -->