szabadpalya/scripts/go.sh

19 lines
553 B
Bash
Executable File

#!/usr/bin/env bash
# Run the Go toolchain without installing it on the host.
#
# The module and build caches live in a named volume, so a second run is fast.
# Everything the container needs is under api/.
#
# ./scripts/go.sh build ./...
# ./scripts/go.sh vet ./...
set -euo pipefail
cd "$(dirname "$0")/.."
docker volume create szp-gocache >/dev/null
exec docker run --rm \
-v "$PWD/api:/src" -v szp-gocache:/gocache \
-e GOMODCACHE=/gocache/mod -e GOCACHE=/gocache/build \
-e GOFLAGS="${GOFLAGS:-}" \
-w /src golang:1.25-alpine go "$@"