Skip to content

Fix Docker build failure by upgrading Go version to support toolchain directive#3

Merged
bio-boris merged 2 commits intomainfrom
copilot/fix-2
Sep 10, 2025
Merged

Fix Docker build failure by upgrading Go version to support toolchain directive#3
bio-boris merged 2 commits intomainfrom
copilot/fix-2

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 10, 2025

The Docker build was failing with the error:

go: errors parsing go.mod:
/app/go.mod:5: unknown directive: toolchain

This occurred because the Dockerfile was installing Go 1.15 from Debian Bullseye packages, but the OpenMaxIO object browser project (v1.7.6) requires Go 1.23 with the toolchain go1.23.6 directive in its go.mod file. The toolchain directive was introduced in Go 1.21, making Go 1.15 incompatible.

Changes Made

  • Replaced Go installation from Debian packages (golang-go) with manual installation of Go 1.23.6
  • Added curl to the package installation list to download the Go binary
  • Set the proper PATH environment variable to include the Go binary location
  • Maintained all other Dockerfile functionality unchanged

The fix is minimal and surgical, addressing only the Go version compatibility issue without modifying any application logic or other dependencies.

Fixes #2.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 10, 2025

@bio-boris 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Co-authored-by: bio-boris <1258634+bio-boris@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing build Fix Docker build failure by upgrading Go version to support toolchain directive Sep 10, 2025
Copilot AI requested a review from bio-boris September 10, 2025 16:16
@bio-boris bio-boris marked this pull request as ready for review September 10, 2025 16:26
Copilot AI review requested due to automatic review settings September 10, 2025 16:26
@bio-boris bio-boris merged commit 5a14849 into main Sep 10, 2025
2 checks passed
@bio-boris bio-boris deleted the copilot/fix-2 branch September 10, 2025 16:26
Copy link
Copy Markdown

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 fixes a Docker build failure by upgrading the Go version from 1.15 to 1.23.6 to support the toolchain directive required by OpenMaxIO object browser v1.7.6.

  • Replaced Debian package installation of Go 1.15 with manual installation of Go 1.23.6
  • Added curl dependency for downloading the Go binary
  • Updated PATH environment variable to include the new Go installation location

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


RUN apt-get update && apt-get install -y git make build-essential golang-go && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y git make build-essential curl && rm -rf /var/lib/apt/lists/*
RUN curl -L https://go.dev/dl/go1.23.6.linux-amd64.tar.gz | tar -C /usr/local -xz
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

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

Downloading and extracting files from the internet without checksum verification poses a security risk. Consider verifying the SHA256 checksum of the downloaded Go binary to ensure integrity and authenticity.

Suggested change
RUN curl -L https://go.dev/dl/go1.23.6.linux-amd64.tar.gz | tar -C /usr/local -xz
RUN curl -L -o go1.23.6.linux-amd64.tar.gz https://go.dev/dl/go1.23.6.linux-amd64.tar.gz && \
curl -L -o go1.23.6.linux-amd64.tar.gz.sha256 https://go.dev/dl/go1.23.6.linux-amd64.tar.gz.sha256 && \
sha256sum -c go1.23.6.linux-amd64.tar.gz.sha256 && \
tar -C /usr/local -xz -f go1.23.6.linux-amd64.tar.gz && \
rm go1.23.6.linux-amd64.tar.gz go1.23.6.linux-amd64.tar.gz.sha256

Copilot uses AI. Check for mistakes.

RUN apt-get update && apt-get install -y git make build-essential golang-go && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y git make build-essential curl && rm -rf /var/lib/apt/lists/*
RUN curl -L https://go.dev/dl/go1.23.6.linux-amd64.tar.gz | tar -C /usr/local -xz
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

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

The Go version 1.23.6 is hardcoded in the URL. Consider using a build argument or environment variable to make the Go version configurable and easier to update in the future.

Suggested change
RUN curl -L https://go.dev/dl/go1.23.6.linux-amd64.tar.gz | tar -C /usr/local -xz
ARG GO_VERSION=1.23.6
RUN curl -L https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xz

Copilot uses AI. Check for mistakes.
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.

Fix failing build

3 participants