generated from codecrafters-io/course-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from codecrafters-io/change-program-interface
change program interface
- Loading branch information
Showing
10 changed files
with
57 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
# | ||
# Learn more: https://codecrafters.io/program-interface | ||
|
||
exec /tmp/interpreter-target "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
#!/bin/sh | ||
# | ||
# DON'T EDIT THIS! | ||
# Use this script to run your program LOCALLY. | ||
# | ||
# CodeCrafters uses this file to test your code. Don't make any changes here! | ||
# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. | ||
# | ||
# DON'T EDIT THIS! | ||
set -e | ||
# Learn more: https://codecrafters.io/program-interface | ||
|
||
tmpFile=$(mktemp) | ||
# Exit early if any commands fail | ||
set -e | ||
|
||
( cd $(dirname "$0") && | ||
go build -o "$tmpFile" ./cmd/myinterpreter ) | ||
# Copied from .codecrafters/compile.sh | ||
# | ||
# - Edit this to change how your program compiles locally | ||
# - Edit .codecrafters/compile.sh to change how your program compiles remotely | ||
go build -o /tmp/interpreter-target ./cmd/myinterpreter | ||
|
||
exec "$tmpFile" "$@" | ||
# Copied from .codecrafters/run.sh | ||
# | ||
# - Edit this to change how your program runs locally | ||
# - Edit .codecrafters/run.sh to change how your program runs remotely | ||
exec /tmp/interpreter-target "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
# syntax=docker/dockerfile:1.7-labs | ||
FROM golang:1.22-alpine | ||
|
||
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 | ||
RUN GODEBUG="installgoroot=all" go install std | ||
|
||
RUN ash -c "set -exo pipefail; go mod graph | awk '{if (\$1 !~ \"@\") {print \$2}}' | xargs -r go get" | ||
|
||
# Once the heavy steps are done, we can copy all files back | ||
COPY . /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
# | ||
# Learn more: https://codecrafters.io/program-interface | ||
|
||
exec /tmp/interpreter-target "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
#!/bin/sh | ||
# | ||
# DON'T EDIT THIS! | ||
# Use this script to run your program LOCALLY. | ||
# | ||
# CodeCrafters uses this file to test your code. Don't make any changes here! | ||
# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. | ||
# | ||
# DON'T EDIT THIS! | ||
set -e | ||
# Learn more: https://codecrafters.io/program-interface | ||
|
||
tmpFile=$(mktemp) | ||
# Exit early if any commands fail | ||
set -e | ||
|
||
( cd $(dirname "$0") && | ||
go build -o "$tmpFile" ./cmd/myinterpreter ) | ||
# Copied from .codecrafters/compile.sh | ||
# | ||
# - Edit this to change how your program compiles locally | ||
# - Edit .codecrafters/compile.sh to change how your program compiles remotely | ||
go build -o /tmp/interpreter-target ./cmd/myinterpreter | ||
|
||
exec "$tmpFile" "$@" | ||
# Copied from .codecrafters/run.sh | ||
# | ||
# - Edit this to change how your program runs locally | ||
# - Edit .codecrafters/run.sh to change how your program runs remotely | ||
exec /tmp/interpreter-target "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
# | ||
# Learn more: https://codecrafters.io/program-interface | ||
|
||
exec /tmp/interpreter-target "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
#!/bin/sh | ||
# | ||
# DON'T EDIT THIS! | ||
# Use this script to run your program LOCALLY. | ||
# | ||
# CodeCrafters uses this file to test your code. Don't make any changes here! | ||
# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. | ||
# | ||
# DON'T EDIT THIS! | ||
set -e | ||
# Learn more: https://codecrafters.io/program-interface | ||
|
||
tmpFile=$(mktemp) | ||
# Exit early if any commands fail | ||
set -e | ||
|
||
( cd $(dirname "$0") && | ||
go build -o "$tmpFile" ./cmd/myinterpreter ) | ||
# Copied from .codecrafters/compile.sh | ||
# | ||
# - Edit this to change how your program compiles locally | ||
# - Edit .codecrafters/compile.sh to change how your program compiles remotely | ||
go build -o /tmp/interpreter-target ./cmd/myinterpreter | ||
|
||
exec "$tmpFile" "$@" | ||
# Copied from .codecrafters/run.sh | ||
# | ||
# - Edit this to change how your program runs locally | ||
# - Edit .codecrafters/run.sh to change how your program runs remotely | ||
exec /tmp/interpreter-target "$@" |