#!/bin/bash # fix.sh - 快速修复构建问题 set -e echo "🔧 Fixing build issues..." echo "" # 1. 清理旧文件 echo "1. Cleaning old files..." rm -f go.mod go.sum rm -f siteproxy siteproxy-* # 2. 初始化模块 echo "2. Initializing Go module..." go mod init siteproxy # 3. 添加依赖 echo "3. Adding dependencies..." go get golang.org/x/net/html # 4. 整理依赖 echo "4. Tidying dependencies..." go mod tidy # 5. 验证构建 echo "5. Verifying build..." if go build -o siteproxy .; then echo "✅ Build successful!" rm -f siteproxy else echo "❌ Build failed!" exit 1 fi echo "" echo "✅ All issues fixed!" echo "" echo "Next steps:" echo " 1. Run: docker-compose build" echo " 2. Run: docker-compose up -d" echo " 3. Access: http://localhost:8080"