Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Conversation

@doringeman
Copy link
Collaborator

@doringeman doringeman commented Sep 22, 2025

$ make release VERSION=test
...

$ otool -l ./dist/darwin-arm64/docker-model | grep LC_BUILD_VERSION -A 3
      cmd LC_BUILD_VERSION
  cmdsize 32
 platform 1
    minos 14.0

Summary by Sourcery

Build:

  • Enable CGO for darwin-arm64 builds and specify macOS deployment target as 14.0 via CFLAGS and LDFLAGS

@sourcery-ai
Copy link

sourcery-ai bot commented Sep 22, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The Makefile’s darwin-arm64 build target now enables CGO and sets macOS deployment flags to enforce a minimum version of 14.0 when building the plugin.

File-Level Changes

Change Details Files
Enforce macOS 14.0 minimum version in the darwin-arm64 build
  • Enabled CGO (CGO_ENABLED=1) for the darwin-arm64 target
  • Added CGO_CFLAGS="-mmacosx-version-min=14.0"
  • Added CGO_LDFLAGS="-mmacosx-version-min=14.0"
Makefile

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on 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 issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on 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 dismiss on 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 review to 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

@gemini-code-assist
Copy link

Summary of Changes

Hello @doringeman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the build configuration for macOS ARM64 targets by enforcing a minimum operating system version of macOS 14.0. This change ensures that the compiled binaries are correctly tagged for compatibility with macOS Sonoma, which can be crucial for leveraging new platform features or adhering to specific deployment requirements.

Highlights

  • Build Configuration Update: The build process for macOS ARM64 binaries has been updated to explicitly set the minimum target operating system version to macOS 14.0 (Sonoma).
  • CGO Enablement: CGO has been enabled for the macOS ARM64 build to facilitate the passing of macOS version-specific flags to the underlying C compiler.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Makefile to set the minimum macOS version to 14.0 for the darwin/arm64 release build. The change correctly uses CGO flags to set the deployment target. I have one suggestion to improve maintainability by defining the version number in a variable to avoid hardcoding values.

Makefile Outdated
fi
@echo "Building release version '$(VERSION)'..."
GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags="-s -w -X github.com/docker/model-cli/desktop.Version=$(VERSION)" -o dist/darwin-arm64/$(PLUGIN_NAME) .
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 CGO_CFLAGS="-mmacosx-version-min=14.0" CGO_LDFLAGS="-mmacosx-version-min=14.0" go build -trimpath -ldflags="-s -w -X github.com/docker/model-cli/desktop.Version=$(VERSION)" -o dist/darwin-arm64/$(PLUGIN_NAME) .

Choose a reason for hiding this comment

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

medium

To improve maintainability and avoid hardcoding values, consider defining the minimum macOS version as a variable at the top of the Makefile. This makes it easier to find and update in the future.

Additionally, since CGO_CFLAGS and CGO_LDFLAGS have the same value, you could define another variable to reduce duplication.

For example:

# At the top of the Makefile
MACOS_MIN_VERSION := 14.0
MACOS_MIN_VERSION_LDFLAG := -mmacosx-version-min=$(MACOS_MIN_VERSION)

# ... inside the release target
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 CGO_CFLAGS="$(MACOS_MIN_VERSION_LDFLAG)" CGO_LDFLAGS="$(MACOS_MIN_VERSION_LDFLAG)" go build ...

@doringeman
Copy link
Collaborator Author

Right, we can't do this because we cross-compile on Linux.

Copy link
Contributor

@ericcurtin ericcurtin left a comment

Choose a reason for hiding this comment

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

Good idea, the older we can go back the better

@ericcurtin
Copy link
Contributor

Right, we can't do this because we cross-compile on Linux.

Did you encounter a machine we were breaking on?

@doringeman
Copy link
Collaborator Author

https://github.com/docker/model-cli/actions/runs/17911633186/job/50924317009?pr=155.
Those flags aren't available on a Linux worker.

@ericcurtin
Copy link
Contributor

https://github.com/docker/model-cli/actions/runs/17911633186/job/50924317009?pr=155. Those flags aren't available on a Linux worker.

Sorry, I meant was there a macOS machine these binaries were deployed to that failed?

@doringeman
Copy link
Collaborator Author

No, we actually built it on macOS 15 and it worked on 14 as well. See: https://github.com/docker/model-cli-release/pull/5#issuecomment-3312968950. I'm also OK to drop CGO and rely on Go's runtime for macOS 14 as well, especially that model-cli doesn't interact with the system API in a fancy way.

jobs:
build:
runs-on: ubuntu-latest
runs-on: macos-latest
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a good idea, why cross-compile when we can do normal compiles :)

This could make it easier to run a few smoke tests also, post-build.

Copy link
Contributor

@xenoscopic xenoscopic left a comment

Choose a reason for hiding this comment

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

LGTM; only thing I could suggest would be doing the variable extraction suggested by Gemini.

@doringeman doringeman merged commit 3d7f55e into docker:main Sep 23, 2025
5 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants