Browse Source

working-ish-ish

content-update
Xavier Petit 4 years ago committed by xpetit
parent
commit
943c5b4daa
  1. 1
      go/Dockerfile
  2. 16
      go/entrypoint.sh

1
go/Dockerfile

@ -2,6 +2,7 @@ FROM golang:1-alpine
RUN apk add --no-cache git nano
RUN go get golang.org/x/tools/cmd/goimports
RUN go get github.com/01-edu/z01
WORKDIR src
COPY entrypoint.sh /usr/local/bin
COPY src .

16
go/entrypoint.sh

@ -2,14 +2,22 @@
set -o errexit
set -o pipefail
set -o nounset
IFS='
'
mkdir -p src/student
cd src/student
if test "$REPOSITORY"; then
git clone --depth=1 --shallow-submodules "$REPOSITORY" .
password=$(cat)
if ! git clone --depth=1 --shallow-submodules https://root:"${password}"@"$REPOSITORY" . 2>/dev/null; then
echo Could not clone your repository
exit 1
fi
else
first_file=$(echo "$EXPECTED_FILES" | cut -d' ' -f1)
mkdir -p "$(dirname $first_file)"
cat > "$first_file"
fi
# Check formatting
@ -27,9 +35,9 @@ if test "$ALLOWED_FUNCTIONS"; then
done
fi
# Compile test
# Compile and run test
cd
GOPATH=$GOPATH:$HOME
GOPATH=$HOME:$GOPATH
if command -v "$EXERCISE"_test &>/dev/null; then
# The exercise is a program
go build "student/$EXERCISE"

Loading…
Cancel
Save