-
Notifications
You must be signed in to change notification settings - Fork 54
Upgrade Go to 1.24 #290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade Go to 1.24 #290
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
|
||
module github.com/codecrafters-io/redis-starter-go | ||
|
||
go 1.22 | ||
go 1.24.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
# syntax=docker/dockerfile:1.7-labs | ||
FROM golang:1.22-alpine | ||
|
||
# Ensures the container is re-built if go.mod or go.sum changes | ||
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="go.mod,go.sum" | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses | ||
COPY --exclude=.git --exclude=README.md . /app | ||
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Invalid COPY Flag Usage The COPY command is using COPY --exclude=.git --exclude=README.md . /app However, Hadolint reports an error (
And then modify the Dockerfile to: -COPY --exclude=.git --exclude=README.md . /app
+COPY . /app This approach will ensure the build context excludes the specified files without using unsupported flags. 🧰 Tools🪛 Hadolint (2.12.0)[error] 10-10: invalid flag: --exclude (DL1000) |
||
|
||
# Starting from Go 1.20, the go standard library is no loger compiled | ||
# setting the GODEBUG environment to "installgoroot=all" restores the old behavior | ||
# Starting from Go 1.20, the go standard library is no loger compiled. | ||
# Setting GODEBUG to "installgoroot=all" restores the old behavior | ||
RUN GODEBUG="installgoroot=all" go install std | ||
|
||
RUN go mod download |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,16 @@ | ||||||||||
# syntax=docker/dockerfile:1.7-labs | ||||||||||
FROM golang:1.24-alpine | ||||||||||
|
||||||||||
# Ensures the container is re-built if go.mod or go.sum changes | ||||||||||
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="go.mod,go.sum" | ||||||||||
|
||||||||||
WORKDIR /app | ||||||||||
|
||||||||||
# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses | ||||||||||
COPY --exclude=.git --exclude=README.md . /app | ||||||||||
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Invalid COPY Flag Parameter The For example, you can apply the following diff: -COPY --exclude=.git --exclude=README.md . /app
+COPY . /app Then, create or update your
📝 Committable suggestion
Suggested change
🧰 Tools🪛 Hadolint (2.12.0)[error] 10-10: invalid flag: --exclude (DL1000) |
||||||||||
|
||||||||||
# Starting from Go 1.20, the go standard library is no loger compiled. | ||||||||||
# Setting GODEBUG to "installgoroot=all" restores the old behavior | ||||||||||
RUN GODEBUG="installgoroot=all" go install std | ||||||||||
|
||||||||||
RUN go mod download |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
|
||
module github.com/codecrafters-io/redis-starter-go | ||
|
||
go 1.22 | ||
go 1.24.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
|
||
module github.com/codecrafters-io/redis-starter-go | ||
|
||
go 1.22 | ||
go 1.24.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
|
||
module github.com/codecrafters-io/redis-starter-go | ||
|
||
go 1.22 | ||
go 1.24.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
attributes: | ||
required_executable: go (1.19) | ||
user_editable_file: app/server.go | ||
required_executable: go (1.24) | ||
user_editable_file: app/main.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Base Image Version Mismatch
The Dockerfile is still using
FROM golang:1.22-alpine
, which does not reflect the PR objective of upgrading to Go 1.24. Consider updating the base image to:If this file is intended to be updated as part of the overall Go upgrade, please make the necessary changes.
📝 Committable suggestion