build: ensure Go init runs before binary compilation

This commit is contained in:
Haitao Pan 2025-12-04 23:20:47 +08:00
parent d0a5a613af
commit 1cc683eaee
3 changed files with 3 additions and 3 deletions

View File

@ -266,7 +266,7 @@ create-super-admin:
# ⚙️ 编译与运行
# =========================================
build:
build: init-go
@go build -o $(APP_NAME) $(MAIN_FILE)
upgrade: build

2
go.mod
View File

@ -8,6 +8,7 @@ require (
github.com/gin-contrib/cors v1.6.0
github.com/gin-gonic/gin v1.9.1
github.com/go-git/go-git/v5 v5.16.2
github.com/golang-jwt/jwt/v5 v5.3.0
github.com/golang-migrate/migrate/v4 v4.19.0
github.com/google/uuid v1.6.0
github.com/jackc/pgx/v5 v5.7.5
@ -46,7 +47,6 @@ require (
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.19.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect

View File

@ -42,7 +42,7 @@ init:
@echo ">>> 可选安装 air (开发热重载)"
@echo "如需安装,请运行: go install github.com/air-verse/air@latest"
build:
build: init
@echo ">>> 编译 $(APP_NAME)"
go build -o $(APP_NAME) $(MAIN_FILE)