diff --git a/compiled_starters/go/README.md b/compiled_starters/go/README.md index c808b2b0..d0f4f0c9 100644 --- a/compiled_starters/go/README.md +++ b/compiled_starters/go/README.md @@ -12,7 +12,7 @@ event loops, the Redis protocol and more. # Passing the first stage -The entry point for your Redis implementation is in `app/server.go`. Study and +The entry point for your Redis implementation is in `app/main.go`. Study and uncomment the relevant code, and push your changes to pass the first stage: ```sh @@ -26,8 +26,8 @@ That's all! Note: This section is for stages 2 and beyond. -1. Ensure you have `go (1.19)` installed locally +1. Ensure you have `go (1.24)` installed locally 1. Run `./your_program.sh` to run your Redis server, which is implemented in - `app/server.go`. + `app/main.go`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/compiled_starters/go/app/server.go b/compiled_starters/go/app/main.go similarity index 100% rename from compiled_starters/go/app/server.go rename to compiled_starters/go/app/main.go diff --git a/compiled_starters/go/codecrafters.yml b/compiled_starters/go/codecrafters.yml index 77886cfb..c7a27eab 100644 --- a/compiled_starters/go/codecrafters.yml +++ b/compiled_starters/go/codecrafters.yml @@ -7,5 +7,5 @@ debug: false # Use this to change the Go version used to run your code # on Codecrafters. # -# Available versions: go-1.22 -language_pack: go-1.22 +# Available versions: go-1.24 +language_pack: go-1.24 diff --git a/compiled_starters/go/go.mod b/compiled_starters/go/go.mod index a8e2d2af..8b20c851 100644 --- a/compiled_starters/go/go.mod +++ b/compiled_starters/go/go.mod @@ -8,4 +8,4 @@ module github.com/codecrafters-io/redis-starter-go -go 1.22 +go 1.24.0 diff --git a/dockerfiles/go-1.22.Dockerfile b/dockerfiles/go-1.22.Dockerfile index 24af02d2..f74d49a6 100644 --- a/dockerfiles/go-1.22.Dockerfile +++ b/dockerfiles/go-1.22.Dockerfile @@ -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 -# 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 diff --git a/dockerfiles/go-1.24.Dockerfile b/dockerfiles/go-1.24.Dockerfile new file mode 100644 index 00000000..fa98f0fa --- /dev/null +++ b/dockerfiles/go-1.24.Dockerfile @@ -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 + +# 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 diff --git a/solutions/go/01-jm1/code/README.md b/solutions/go/01-jm1/code/README.md index c808b2b0..d0f4f0c9 100644 --- a/solutions/go/01-jm1/code/README.md +++ b/solutions/go/01-jm1/code/README.md @@ -12,7 +12,7 @@ event loops, the Redis protocol and more. # Passing the first stage -The entry point for your Redis implementation is in `app/server.go`. Study and +The entry point for your Redis implementation is in `app/main.go`. Study and uncomment the relevant code, and push your changes to pass the first stage: ```sh @@ -26,8 +26,8 @@ That's all! Note: This section is for stages 2 and beyond. -1. Ensure you have `go (1.19)` installed locally +1. Ensure you have `go (1.24)` installed locally 1. Run `./your_program.sh` to run your Redis server, which is implemented in - `app/server.go`. + `app/main.go`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/solutions/go/01-jm1/code/app/server.go b/solutions/go/01-jm1/code/app/main.go similarity index 100% rename from solutions/go/01-jm1/code/app/server.go rename to solutions/go/01-jm1/code/app/main.go diff --git a/solutions/go/01-jm1/code/codecrafters.yml b/solutions/go/01-jm1/code/codecrafters.yml index 77886cfb..c7a27eab 100644 --- a/solutions/go/01-jm1/code/codecrafters.yml +++ b/solutions/go/01-jm1/code/codecrafters.yml @@ -7,5 +7,5 @@ debug: false # Use this to change the Go version used to run your code # on Codecrafters. # -# Available versions: go-1.22 -language_pack: go-1.22 +# Available versions: go-1.24 +language_pack: go-1.24 diff --git a/solutions/go/01-jm1/code/go.mod b/solutions/go/01-jm1/code/go.mod index a8e2d2af..8b20c851 100644 --- a/solutions/go/01-jm1/code/go.mod +++ b/solutions/go/01-jm1/code/go.mod @@ -8,4 +8,4 @@ module github.com/codecrafters-io/redis-starter-go -go 1.22 +go 1.24.0 diff --git a/solutions/go/01-jm1/diff/app/server.go.diff b/solutions/go/01-jm1/diff/app/main.go.diff similarity index 100% rename from solutions/go/01-jm1/diff/app/server.go.diff rename to solutions/go/01-jm1/diff/app/main.go.diff diff --git a/solutions/go/01-jm1/explanation.md b/solutions/go/01-jm1/explanation.md index d1e9f947..95fd319e 100644 --- a/solutions/go/01-jm1/explanation.md +++ b/solutions/go/01-jm1/explanation.md @@ -1,4 +1,4 @@ -The entry point for your Redis implementation is in `app/server.go`. +The entry point for your Redis implementation is in `app/main.go`. Study and uncomment the relevant code: diff --git a/solutions/go/02-rg2/code/README.md b/solutions/go/02-rg2/code/README.md index c808b2b0..d0f4f0c9 100644 --- a/solutions/go/02-rg2/code/README.md +++ b/solutions/go/02-rg2/code/README.md @@ -12,7 +12,7 @@ event loops, the Redis protocol and more. # Passing the first stage -The entry point for your Redis implementation is in `app/server.go`. Study and +The entry point for your Redis implementation is in `app/main.go`. Study and uncomment the relevant code, and push your changes to pass the first stage: ```sh @@ -26,8 +26,8 @@ That's all! Note: This section is for stages 2 and beyond. -1. Ensure you have `go (1.19)` installed locally +1. Ensure you have `go (1.24)` installed locally 1. Run `./your_program.sh` to run your Redis server, which is implemented in - `app/server.go`. + `app/main.go`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/solutions/go/02-rg2/code/app/server.go b/solutions/go/02-rg2/code/app/main.go similarity index 100% rename from solutions/go/02-rg2/code/app/server.go rename to solutions/go/02-rg2/code/app/main.go diff --git a/solutions/go/02-rg2/code/codecrafters.yml b/solutions/go/02-rg2/code/codecrafters.yml index 77886cfb..c7a27eab 100644 --- a/solutions/go/02-rg2/code/codecrafters.yml +++ b/solutions/go/02-rg2/code/codecrafters.yml @@ -7,5 +7,5 @@ debug: false # Use this to change the Go version used to run your code # on Codecrafters. # -# Available versions: go-1.22 -language_pack: go-1.22 +# Available versions: go-1.24 +language_pack: go-1.24 diff --git a/solutions/go/02-rg2/code/go.mod b/solutions/go/02-rg2/code/go.mod index a8e2d2af..8b20c851 100644 --- a/solutions/go/02-rg2/code/go.mod +++ b/solutions/go/02-rg2/code/go.mod @@ -8,4 +8,4 @@ module github.com/codecrafters-io/redis-starter-go -go 1.22 +go 1.24.0 diff --git a/solutions/go/02-rg2/diff/app/server.go.diff b/solutions/go/02-rg2/diff/app/main.go.diff similarity index 100% rename from solutions/go/02-rg2/diff/app/server.go.diff rename to solutions/go/02-rg2/diff/app/main.go.diff diff --git a/starter_templates/go/code/app/server.go b/starter_templates/go/code/app/main.go similarity index 100% rename from starter_templates/go/code/app/server.go rename to starter_templates/go/code/app/main.go diff --git a/starter_templates/go/code/go.mod b/starter_templates/go/code/go.mod index a8e2d2af..8b20c851 100644 --- a/starter_templates/go/code/go.mod +++ b/starter_templates/go/code/go.mod @@ -8,4 +8,4 @@ module github.com/codecrafters-io/redis-starter-go -go 1.22 +go 1.24.0 diff --git a/starter_templates/go/config.yml b/starter_templates/go/config.yml index 60ba3c3c..019425cf 100644 --- a/starter_templates/go/config.yml +++ b/starter_templates/go/config.yml @@ -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