#!/bin/bash

# SPDX-License-Identifier: Apache-2.0
# Copyright 2025 Damn Vulnerable Go Application

echo "🚨 Building Damn Vulnerable Go Application..."
echo "⚠️  WARNING: This application contains intentional security vulnerabilities!"
echo ""

# Download dependencies
echo "📦 Downloading dependencies..."
go mod tidy

# Build the application
echo "🔨 Building application..."
go build -o vulnerable_app vulnerable_app.go

if [ $? -eq 0 ]; then
    echo "✅ Build successful!"
    echo ""
    echo "🚀 To run the application:"
    echo "   ./vulnerable_app"
    echo ""
    echo "🌐 The server will be available at:"
    echo "   http://localhost:8080"
    echo ""
    echo "📚 See VULNERABILITIES.md for detailed vulnerability descriptions"
else
    echo "❌ Build failed!"
    exit 1
fi