Skip to content

chore: disable CGO in Makefile - #985

Merged
Andriy Knysh (aknysh) merged 1 commit into
mainfrom
chore-disable-cgo
Jan 30, 2025
Merged

Andriy Knysh (aknysh) merged 1 commit into
mainfrom
chore-disable-cgo

Conversation

@suzuki-shunsuke

@suzuki-shunsuke Shunsuke Suzuki (suzuki-shunsuke) commented Jan 30, 2025 •

Copy link
Copy Markdown
Contributor

what

Disable CGO in Makefile.

why

By default CGO is enabled.
In .goreleaser.yml, CGO is disabled.

atmos/.goreleaser.yml

Lines 8 to 11 in 255a05a

# goreleaser does not work with CGO, it could also complicate
# usage by users in CI/CD systems like Terraform Cloud where
# they are unable to install libraries.
- CGO_ENABLED=0

Enabling CGO causes problemds like that. #926 (comment)

references

Summary by CodeRabbit

  • Chores
    • Updated build configuration to disable CGO
    • Removed external build harness dependency

@mergify

mergify Bot commented Jan 30, 2025

Copy link
Copy Markdown
Contributor

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify Bot added triage Needs triage needs-cloudposse Needs Cloud Posse assistance labels Jan 30, 2025
@suzuki-shunsuke

Shunsuke Suzuki (suzuki-shunsuke) commented Jan 30, 2025 •

Copy link
Copy Markdown
Contributor Author

Maybe we should replace go build with goreleaser build in Makefile to unify build options.
But in this pull request I'll disable CGO in Makefile simply.

$ mkdir build
$ GOOS=linux goreleaser build --single-target --skip before,post-hooks,pre-hooks,validate --clean -o build/atmos
  • only configurations files on  version: 2  are supported, yours is  version: 0 , please update your configuration
  • skipping before, post-hooks, pre-hooks and validate...
  • cleaning distribution directory
  • loading environment variables
  • getting and validating git state
    • git state                                      commit=4d35c0a973d929b15040f419aa728bffe4520826 branch=chore-disable-cgo current_tag=v1.156.0 previous_tag=v1.155.0 dirty=true
    • pipe skipped                                   reason=validation is disabled
  • parsing tag
  • setting defaults
    • DEPRECATED:  archives.format  should not be used anymore, check https://goreleaser.com/deprecations#archivesformat for more info
  • partial
  • ensuring distribution directory
  • setting up metadata
  • writing release metadata
  • loading go mod information
  • build prerequisites
  • building binaries
    • partial build                                  match=target=linux_arm64_v8.0
    • building                                       binary=dist/atmos_linux_arm64_v8.0/atmos
  • writing artifacts metadata
  • copying binary to "build/atmos"
  • you are using deprecated options, check the output above for details
  • build succeeded after 3s
  • thanks for using GoReleaser!

$ ls build/atmos 
build/atmos

@coderabbitai

coderabbitai Bot commented Jan 30, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The Makefile has undergone targeted modifications affecting build configuration. A key change involves explicitly setting CGO_ENABLED=0, which instructs the Go compiler to compile without CGo support, potentially simplifying the build process. Simultaneously, a remote build harness inclusion mechanism has been removed, suggesting a shift in dependency management strategy.

Changes

File Change Summary
Makefile - Added export CGO_ENABLED=0 environment variable
- Removed remote build harness inclusion line

The changes are straightforward yet impactful, representing a lean approach to build configuration management. The removal of the dynamic build harness and explicit CGo disabling indicate a move towards more predictable and controlled compilation processes.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 255a05a and 4d35c0a.

📒 Files selected for processing (1)
  • Makefile (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Build (macos-latest, macos)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Build (ubuntu-latest, linux)
  • GitHub Check: Analyze (go)
  • GitHub Check: Summary
🔇 Additional comments (2)
Makefile (2)

11-11: LGTM! Strategic placement of CGO_ENABLED=0 👊

The addition of export CGO_ENABLED=0 is well-placed before any build commands and aligns perfectly with your .goreleaser.yml configuration. This will help prevent the CGO-related issues mentioned in #926.


Line range hint 15-15: Verify impact of build harness removal

The removal of the remote build harness inclusion is a good security practice. However, let's verify that we haven't lost any critical functionality.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 for this PR. (Beta)
  • @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 or @auto-summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @auto-title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@mergify mergify Bot removed the triage Needs triage label Jan 30, 2025
@osterman

Copy link
Copy Markdown
Member

Maybe we should replace go build with goreleaser build in Makefile to unify build options.
But in this pull request I'll disable CGO in Makefile simply.

We have a ton of these types of improvements in our backlog. I'll make a new one for this. I really appreciate the suggestions. Keep 'em coming!

@aknysh Andriy Knysh (aknysh) added the no-release Do not create a new release (wait for additional code changes) label Jan 30, 2025

@aknysh Andriy Knysh (aknysh) left a comment

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.

@aknysh
Andriy Knysh (aknysh) merged commit 1f5d88b into main Jan 30, 2025
@aknysh
Andriy Knysh (aknysh) deleted the chore-disable-cgo branch January 30, 2025 15:32
@mergify mergify Bot removed the needs-cloudposse Needs Cloud Posse assistance label Jan 30, 2025
@github-actions

Copy link
Copy Markdown

These changes were released in v1.157.0.

@coderabbitai coderabbitai Bot mentioned this pull request Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants