From 943c5b4daa8e887d69feb3eb6b518dcf59487dce Mon Sep 17 00:00:00 2001 From: Xavier Petit <32063953+xpetit@users.noreply.github.com> Date: Fri, 15 May 2020 21:40:55 +0200 Subject: [PATCH] working-ish-ish --- go/Dockerfile | 1 + go/entrypoint.sh | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/go/Dockerfile b/go/Dockerfile index 3bfd41586..a743d0319 100644 --- a/go/Dockerfile +++ b/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 . diff --git a/go/entrypoint.sh b/go/entrypoint.sh index bc591de4a..f3aa8f241 100644 --- a/go/entrypoint.sh +++ b/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"