| 123456789101112131415161718192021222324252627282930 |
- #!/bin/bash
- # 安装 gentool 的脚本
- # 用于安装 gorm.io/gen/tools/gentool 工具
- # https://gorm.io/zh_CN/gen/gen_tool.html
- # 检查 gentool 是否已安装
- if command -v gentool >/dev/null 2>&1; then
- echo "✅ gentool 已安装"
- else
- echo "📥 开始安装 gentool..."
- # 设置 GOPROXY 环境变量
- export GOPROXY=https://goproxy.cn,direct
- # 安装 gentool
- echo "📦 正在安装 gentool..."
- if ! go install gorm.io/gen/tools/gentool@latest; then
- echo "❌ gentool 安装失败"
- exit 1
- fi
- # 验证 gentool 安装是否成功
- if command -v gentool >/dev/null 2>&1; then
- echo "✅ gentool 安装成功"
- else
- echo "❌ gentool 安装失败"
- exit 1
- fi
- fi
|