#!/bin/bash set -e BINARY_NAME="gophergate" SOURCE_PATH="./cmd/gophergate/main.go" echo "Pulling latest changes from git..." git stash || true git pull echo "Building the application..." go build -o "$BINARY_NAME" "$SOURCE_PATH" echo "Restarting service..." systemctl restart gophergate sleep 2 if systemctl is-active --quiet gophergate; then echo "Deploy complete. Service is running." systemctl status gophergate --no-pager | head -5 else echo "Service failed to start! Check: journalctl -u gophergate -n 20" exit 1 fi