removed 'build mode' from run scripts
Some checks failed
Run Integration Tests / test (push) Failing after 21s
Some checks failed
Run Integration Tests / test (push) Failing after 21s
This commit is contained in:
parent
0851e9e9f2
commit
27c29c185a
2 changed files with 40 additions and 49 deletions
43
run.bat
43
run.bat
|
@ -5,7 +5,6 @@ rem Initialize variables
|
||||||
set SKIP_CONFIG=""
|
set SKIP_CONFIG=""
|
||||||
set PORT=""
|
set PORT=""
|
||||||
set DOMAIN=""
|
set DOMAIN=""
|
||||||
set BUILD_MODE=false
|
|
||||||
set BUILD_OUTPUT=qgato.exe
|
set BUILD_OUTPUT=qgato.exe
|
||||||
|
|
||||||
rem Parse arguments
|
rem Parse arguments
|
||||||
|
@ -28,11 +27,6 @@ if "%~1"=="--skip-config-check" (
|
||||||
shift
|
shift
|
||||||
goto parse_args
|
goto parse_args
|
||||||
)
|
)
|
||||||
if "%~1"=="--build" (
|
|
||||||
set BUILD_MODE=true
|
|
||||||
shift
|
|
||||||
goto parse_args
|
|
||||||
)
|
|
||||||
echo Unknown argument: %~1
|
echo Unknown argument: %~1
|
||||||
exit /b 1
|
exit /b 1
|
||||||
|
|
||||||
|
@ -50,27 +44,28 @@ for %%f in (*.go) do (
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if "%BUILD_MODE%"=="true" (
|
rem Always delete and rebuild the binary
|
||||||
rem Build mode
|
echo Cleaning previous build...
|
||||||
echo Building application...
|
if exist "%BUILD_OUTPUT%" del "%BUILD_OUTPUT%"
|
||||||
go build -o "%BUILD_OUTPUT%" !GO_FILES!
|
|
||||||
if errorlevel 1 (
|
echo Building application...
|
||||||
|
go build -o "%BUILD_OUTPUT%" !GO_FILES!
|
||||||
|
if errorlevel 1 (
|
||||||
echo Build failed!
|
echo Build failed!
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
|
||||||
echo Build successful! Output: %CD%\%BUILD_OUTPUT%
|
|
||||||
) else (
|
|
||||||
rem Construct the command
|
|
||||||
set CMD=go run !GO_FILES! !SKIP_CONFIG!
|
|
||||||
if not "%PORT%"=="" set CMD=!CMD! --port %PORT%
|
|
||||||
if not "%DOMAIN%"=="" set CMD=!CMD! --domain %DOMAIN%
|
|
||||||
|
|
||||||
rem Informative output
|
|
||||||
echo Starting application with command: !CMD!
|
|
||||||
|
|
||||||
rem Run the Go program with the constructed command
|
|
||||||
call !CMD!
|
|
||||||
)
|
)
|
||||||
|
echo Build successful! Output: %CD%\%BUILD_OUTPUT%
|
||||||
|
|
||||||
|
rem Construct the command
|
||||||
|
set CMD=%BUILD_OUTPUT% !SKIP_CONFIG!
|
||||||
|
if not "%PORT%"=="" set CMD=!CMD! --port %PORT%
|
||||||
|
if not "%DOMAIN%"=="" set CMD=!CMD! --domain %DOMAIN%
|
||||||
|
|
||||||
|
rem Informative output
|
||||||
|
echo Starting application with command: !CMD!
|
||||||
|
|
||||||
|
rem Run the built executable
|
||||||
|
call !CMD!
|
||||||
|
|
||||||
rem Return to the original directory
|
rem Return to the original directory
|
||||||
popd
|
popd
|
||||||
|
|
40
run.sh
40
run.sh
|
@ -4,7 +4,6 @@
|
||||||
SKIP_CONFIG=""
|
SKIP_CONFIG=""
|
||||||
PORT=""
|
PORT=""
|
||||||
DOMAIN=""
|
DOMAIN=""
|
||||||
BUILD_MODE=false
|
|
||||||
BUILD_OUTPUT="qgato"
|
BUILD_OUTPUT="qgato"
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
|
@ -22,10 +21,6 @@ while [ $# -gt 0 ]; do
|
||||||
SKIP_CONFIG="--skip-config-check"
|
SKIP_CONFIG="--skip-config-check"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--build)
|
|
||||||
BUILD_MODE=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo "Unknown argument: $1"
|
echo "Unknown argument: $1"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -39,24 +34,25 @@ SCRIPT_DIR=$(dirname "$0")
|
||||||
# List all Go files in the script directory (excluding test files)
|
# List all Go files in the script directory (excluding test files)
|
||||||
GO_FILES=$(find "$SCRIPT_DIR" -name '*.go' ! -name '*_test.go' -print)
|
GO_FILES=$(find "$SCRIPT_DIR" -name '*.go' ! -name '*_test.go' -print)
|
||||||
|
|
||||||
if $BUILD_MODE; then
|
# Always delete and rebuild the binary
|
||||||
# Build mode
|
echo "Cleaning previous build..."
|
||||||
echo "Building application..."
|
rm -f "$SCRIPT_DIR/$BUILD_OUTPUT"
|
||||||
go build -o "$SCRIPT_DIR/$BUILD_OUTPUT" $GO_FILES
|
|
||||||
if [ $? -eq 0 ]; then
|
echo "Building application..."
|
||||||
|
go build -o "$SCRIPT_DIR/$BUILD_OUTPUT" $GO_FILES
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
echo "Build successful! Output: $SCRIPT_DIR/$BUILD_OUTPUT"
|
echo "Build successful! Output: $SCRIPT_DIR/$BUILD_OUTPUT"
|
||||||
else
|
else
|
||||||
echo "Build failed!"
|
echo "Build failed!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
|
||||||
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
|
|
||||||
fi
|
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue