removed 'build mode' from run scripts
Some checks failed
Run Integration Tests / test (push) Failing after 21s

This commit is contained in:
partisan 2025-01-08 00:29:21 +01:00
parent 0851e9e9f2
commit 27c29c185a
2 changed files with 40 additions and 49 deletions

44
run.sh
View file

@ -4,7 +4,6 @@
SKIP_CONFIG=""
PORT=""
DOMAIN=""
BUILD_MODE=false
BUILD_OUTPUT="qgato"
# Parse arguments
@ -22,10 +21,6 @@ while [ $# -gt 0 ]; do
SKIP_CONFIG="--skip-config-check"
shift
;;
--build)
BUILD_MODE=true
shift
;;
*)
echo "Unknown argument: $1"
exit 1
@ -39,24 +34,25 @@ SCRIPT_DIR=$(dirname "$0")
# List all Go files in the script directory (excluding test files)
GO_FILES=$(find "$SCRIPT_DIR" -name '*.go' ! -name '*_test.go' -print)
if $BUILD_MODE; then
# Build mode
echo "Building application..."
go build -o "$SCRIPT_DIR/$BUILD_OUTPUT" $GO_FILES
if [ $? -eq 0 ]; then
echo "Build successful! Output: $SCRIPT_DIR/$BUILD_OUTPUT"
else
echo "Build failed!"
exit 1
fi
# Always delete and rebuild the binary
echo "Cleaning previous build..."
rm -f "$SCRIPT_DIR/$BUILD_OUTPUT"
echo "Building application..."
go build -o "$SCRIPT_DIR/$BUILD_OUTPUT" $GO_FILES
if [ $? -eq 0 ]; then
echo "Build successful! Output: $SCRIPT_DIR/$BUILD_OUTPUT"
else
# Run mode
CMD="go run $GO_FILES $SKIP_CONFIG"
[ -n "$PORT" ] && CMD="$CMD --port $PORT"
[ -n "$DOMAIN" ] && CMD="$CMD --domain $DOMAIN"
echo "Starting application with command: $CMD"
# Run the Go program with the constructed command
eval $CMD
echo "Build failed!"
exit 1
fi
# Construct the run command
CMD="$SCRIPT_DIR/$BUILD_OUTPUT $SKIP_CONFIG"
[ -n "$PORT" ] && CMD="$CMD --port $PORT"
[ -n "$DOMAIN" ] && CMD="$CMD --domain $DOMAIN"
echo "Starting application with command: $CMD"
# Run the built executable
eval $CMD