Skip to content

Conversation

@crazy-max
Copy link
Member

@crazy-max crazy-max commented Oct 6, 2025

  • Toolchain should never be specified and always be local, specially with container builds.
  • Also go version patch should be specified in go.mod at the lowest and should always be .0.
  • Module name is incorrect for submodule located at ./cmd/cli.

Also found that tag that have been created are wrong if they are meant for cmd/cli submodule: https://github.com/docker/model-runner/tags

image

@doringeman It should be cmd/cli/v0.1.43 so then you can vendor github.com/docker/model-runner/cmd/cli v0.1.43 for the cli reference on docs repo.

cc @thaJeztah @vvoland for extra 👀 related to packaging.

Summary by Sourcery

Remove explicit Go toolchain specs and align Go version patches in go.mod files, fix the CLI submodule’s module path, and simplify the Dockerfile’s GO_VERSION argument

Bug Fixes:

  • Correct the module path in cmd/cli go.mod to github.com/docker/model-runner/cmd/cli

Enhancements:

  • Remove explicit toolchain directives from go.mod files
  • Standardize Go version patch levels to .0 in go.mod files

Build:

  • Update Dockerfile GO_VERSION argument to use major.minor only

Copilot AI review requested due to automatic review settings October 6, 2025 12:53
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 6, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR removes explicit Go toolchain directives, standardizes Go version to the lowest patch .0, corrects the CLI submodule's module path, and updates the Dockerfile's Go version argument.

Entity relationship diagram for updated Go modules

erDiagram
    "model-runner" {
        string module_name
        string go_version
    }
    "cli" {
        string module_name
        string go_version
    }
    "model-runner" ||--o| "cli" : contains
    "model-runner" : module_name = "github.com/docker/model-runner"
    "model-runner" : go_version = "1.24.0"
    "cli" : module_name = "github.com/docker/model-runner/cmd/cli"
    "cli" : go_version = "1.24.0"
Loading

File-Level Changes

Change Details Files
Removed Go toolchain directives and standardized Go version to .0
  • Removed 'toolchain' directive
  • Set Go version to 1.24.0
go.mod
cmd/cli/go.mod
Corrected module path for the CLI submodule
  • Updated module name to github.com/docker/model-runner/cmd/cli
cmd/cli/go.mod
Aligned Dockerfile Go version argument
  • Changed ARG GO_VERSION to 1.24
Dockerfile

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
Contributor

Summary of Changes

Hello @crazy-max, 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 Go module configuration and Dockerfile Go versioning to improve build consistency and module management. It removes explicit toolchain declarations, standardizes Go version specifications to their base patch level, and corrects the module path for the cmd/cli submodule. These changes ensure better adherence to Go module best practices and facilitate correct dependency resolution, particularly in containerized build environments.

Highlights

  • Go Module Toolchain Removal: The explicit toolchain directive has been removed from both the root go.mod and cmd/cli/go.mod files. This aligns with best practices, especially for containerized builds, where the toolchain should typically be managed locally or by the build environment.
  • Standardized Go Version Patch Level: The go directive in both go.mod files has been updated to specify the patch version as .0 (e.g., go 1.24.0). This ensures consistency and adheres to the recommended lowest patch version specification.
  • Corrected CLI Submodule Path: The module name in cmd/cli/go.mod has been corrected from github.com/docker/model-cli to github.com/docker/model-runner/cmd/cli. This fix ensures proper referencing and vendoring of the CLI submodule, addressing potential issues with external consumption.
  • Dockerfile Go Version Update: The GO_VERSION argument in the Dockerfile has been adjusted from 1.24.2 to 1.24, aligning with the general version specification without a specific patch for the build argument.
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
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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
Contributor

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 standardizes Go module configuration and fixes module naming issues. It removes explicit toolchain specifications and corrects the CLI submodule's module path to follow proper Go module conventions.

  • Remove explicit toolchain specifications from go.mod files
  • Standardize Go version format to use .0 patch version
  • Fix CLI submodule path from github.com/docker/model-cli to github.com/docker/model-runner/cmd/cli

Reviewed Changes

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

File Description
go.mod Remove toolchain specification and standardize Go version to 1.24.0
cmd/cli/go.mod Fix module path and remove toolchain specification
Dockerfile Update Go version ARG to match module version format

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

go 1.24

toolchain go1.24.4
go 1.24.0
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

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

Go version in go.mod should not include patch version. Use 'go 1.24' instead of 'go 1.24.0' as the patch version is not meaningful in go.mod files and Go toolchain ignores it.

Suggested change
go 1.24.0
go 1.24

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

That's wrong copilot, starting with Go 1.21, the Go team introduced a more precise versioning format that includes the patch version so we should set it to the lowest and let the local toolchain deal with compat

go 1.24

toolchain go1.24.4
go 1.24.0
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

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

Go version in go.mod should not include patch version. Use 'go 1.24' instead of 'go 1.24.0' as the patch version is not meaningful in go.mod files and Go toolchain ignores it.

Suggested change
go 1.24.0
go 1.24

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@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 - here's some feedback:

  • Run go mod tidy on both the root and cmd/cli modules to clean up go.sum and reflect these changes.
  • Search for and update any remaining import paths or documentation references from github.com/docker/model-cli to github.com/docker/model-runner/cmd/cli.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Run go mod tidy on both the root and cmd/cli modules to clean up go.sum and reflect these changes.
- Search for and update any remaining import paths or documentation references from github.com/docker/model-cli to github.com/docker/model-runner/cmd/cli.

## Individual Comments

### Comment 1
<location> `Dockerfile:3` </location>
<code_context>
 # syntax=docker/dockerfile:1

-ARG GO_VERSION=1.24.2
+ARG GO_VERSION=1.24
 ARG LLAMA_SERVER_VERSION=latest
 ARG LLAMA_SERVER_VARIANT=cpu
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Using a major.minor version for GO_VERSION may lead to non-deterministic builds.

Pinning GO_VERSION to a specific patch release ensures consistent builds and avoids unexpected changes from future patch updates.

```suggestion
ARG GO_VERSION=1.24.2
```
</issue_to_address>

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
Contributor

@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 introduces several improvements to the Go module configuration and Docker build process. The changes correctly update the module path for the cmd/cli submodule, which is a crucial fix for its usability. Removing the toolchain directive from the go.mod files is a good practice that provides more flexibility for developers and CI environments. Setting the Go version to 1.24.0 and updating the GO_VERSION argument in the Dockerfile are consistent and align with modern Go practices. Overall, these are solid changes that improve the project's maintainability and build configuration.

Copy link
Contributor

@doringeman doringeman left a comment

Choose a reason for hiding this comment

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

Thank you!

@doringeman doringeman merged commit 039f7a3 into docker:main Oct 6, 2025
6 checks passed
@crazy-max crazy-max deleted the fix-go-mods branch October 6, 2025 13:33
aevesdocker pushed a commit to docker/docs that referenced this pull request Oct 6, 2025
<!--Delete sections as needed -->

## Description

<!-- Tell us what you did and why -->

## Related issues or tickets

* docker/model-runner#190
* docker/model-runner#195

## Reviews

<!-- Notes for reviewers here -->
<!-- List applicable reviews (optionally @tag reviewers) -->

- [ ] Technical review
- [ ] Editorial review
- [ ] Product review

Signed-off-by: CrazyMax <[email protected]>
@thaJeztah
Copy link
Member

Do we know why CI didn't fail on the original PR? Seems like the code wouldn't compile before this fix 🤔

Or does CI have to be modified to account for multiple-modules? They can be a bit of a pain, because a go test ./.... (or variants thereof) won't recursively test modules.

@doringeman
Copy link
Contributor

Do we know why CI didn't fail on the original PR? Seems like the code wouldn't compile before this fix 🤔

You mean #190? The code was using the old module name, so the go build worked.

FWIW here's a new PR to account for multiple modules: #196.

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.

3 participants