Skip to content

Commit d591957

Browse files
authored
Merge pull request #112 from codecrafters-io/andy/upgrade
Upgrade Go to 1.24
2 parents 26d05b7 + 79e074f commit d591957

File tree

20 files changed

+45
-26
lines changed

20 files changed

+45
-26
lines changed

compiled_starters/go/.codecrafters/compile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
set -e # Exit on failure
1010

11-
go build -o /tmp/codecrafters-build-grep-go cmd/mygrep/main.go
11+
go build -o /tmp/codecrafters-build-grep-go app/*.go

compiled_starters/go/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ expressions are evaluated.
1717

1818
# Passing the first stage
1919

20-
The entry point for your `grep` implementation is in `cmd/mygrep/main.go`. Study
21-
and uncomment the relevant code, and push your changes to pass the first stage:
20+
The entry point for your `grep` implementation is in `app/main.go`. Study and
21+
uncomment the relevant code, and push your changes to pass the first stage:
2222

2323
```sh
2424
git commit -am "pass 1st stage" # any msg
@@ -31,8 +31,8 @@ Time to move on to the next stage!
3131

3232
Note: This section is for stages 2 and beyond.
3333

34-
1. Ensure you have `go (1.19)` installed locally
34+
1. Ensure you have `go (1.24)` installed locally
3535
1. Run `./your_program.sh` to run your program, which is implemented in
36-
`cmd/mygrep/main.go`.
36+
`app/main.go`.
3737
1. Commit your changes and run `git push origin master` to submit your solution
3838
to CodeCrafters. Test output will be streamed to your terminal.
File renamed without changes.

compiled_starters/go/codecrafters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ debug: false
77
# Use this to change the Go version used to run your code
88
# on Codecrafters.
99
#
10-
# Available versions: go-1.22
11-
language_pack: go-1.22
10+
# Available versions: go-1.24
11+
language_pack: go-1.24

compiled_starters/go/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
module github.com/codecrafters-io/grep-starter-go
1010

11-
go 1.22
11+
go 1.24.0

compiled_starters/go/your_program.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set -e # Exit early if any commands fail
1414
# - Edit .codecrafters/compile.sh to change how your program compiles remotely
1515
(
1616
cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory
17-
go build -o /tmp/codecrafters-build-grep-go cmd/mygrep/main.go
17+
go build -o /tmp/codecrafters-build-grep-go app/*.go
1818
)
1919

2020
# Copied from .codecrafters/run.sh

dockerfiles/go-1.22.Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1+
# syntax=docker/dockerfile:1.7-labs
12
FROM golang:1.22-alpine
23

4+
# Ensures the container is re-built if go.mod or go.sum changes
35
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="go.mod,go.sum"
46

57
WORKDIR /app
68

7-
COPY go.mod go.sum ./
9+
# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
10+
COPY --exclude=.git --exclude=README.md . /app
811

9-
# Starting from Go 1.20, the go standard library is no loger compiled
10-
# setting the GODEBUG environment to "installgoroot=all" restores the old behavior
12+
# Starting from Go 1.20, the go standard library is no loger compiled.
13+
# Setting GODEBUG to "installgoroot=all" restores the old behavior
1114
RUN GODEBUG="installgoroot=all" go install std
1215

1316
RUN go mod download

dockerfiles/go-1.24.Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# syntax=docker/dockerfile:1.7-labs
2+
FROM golang:1.24-alpine
3+
4+
# Ensures the container is re-built if go.mod or go.sum changes
5+
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="go.mod,go.sum"
6+
7+
WORKDIR /app
8+
9+
# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
10+
COPY --exclude=.git --exclude=README.md . /app
11+
12+
# Starting from Go 1.20, the go standard library is no loger compiled.
13+
# Setting GODEBUG to "installgoroot=all" restores the old behavior
14+
RUN GODEBUG="installgoroot=all" go install std
15+
16+
RUN go mod download

solutions/go/01-cq2/code/.codecrafters/compile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
set -e # Exit on failure
1010

11-
go build -o /tmp/codecrafters-build-grep-go cmd/mygrep/main.go
11+
go build -o /tmp/codecrafters-build-grep-go app/*.go

solutions/go/01-cq2/code/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ expressions are evaluated.
1717

1818
# Passing the first stage
1919

20-
The entry point for your `grep` implementation is in `cmd/mygrep/main.go`. Study
21-
and uncomment the relevant code, and push your changes to pass the first stage:
20+
The entry point for your `grep` implementation is in `app/main.go`. Study and
21+
uncomment the relevant code, and push your changes to pass the first stage:
2222

2323
```sh
2424
git commit -am "pass 1st stage" # any msg
@@ -31,8 +31,8 @@ Time to move on to the next stage!
3131

3232
Note: This section is for stages 2 and beyond.
3333

34-
1. Ensure you have `go (1.19)` installed locally
34+
1. Ensure you have `go (1.24)` installed locally
3535
1. Run `./your_program.sh` to run your program, which is implemented in
36-
`cmd/mygrep/main.go`.
36+
`app/main.go`.
3737
1. Commit your changes and run `git push origin master` to submit your solution
3838
to CodeCrafters. Test output will be streamed to your terminal.

0 commit comments

Comments
 (0)