-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 配置文件补充port和debug字段,新增makefile文件
- Loading branch information
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
server: | ||
port: "8080" | ||
debug: true | ||
|
||
database: | ||
name: 4u_db | ||
host: "127.0.0.1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 设置环境变量 | ||
CGO_ENABLED=0 | ||
GOOS=linux | ||
GOARCH=amd64 | ||
|
||
# Go 文件 | ||
TARGET=main | ||
|
||
# 默认目标 | ||
all: build | ||
|
||
# 构建目标 | ||
build: | ||
@echo "Building $(TARGET)..." | ||
go build -o $(TARGET) $(TARGET).go | ||
|
||
# 编译为 Linux 目标 | ||
build-linux: | ||
@echo "Building $(TARGET) for $(GOOS)/$(GOARCH)..." | ||
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=$(CGO_ENABLED) go build -o $(TARGET) $(TARGET).go | ||
|
||
# 清理生成的文件 | ||
clean: | ||
@echo "Cleaning up..." | ||
rm -f $(TARGET) | ||
|
||
# 运行程序 | ||
run: build | ||
@echo "Running $(TARGET)..." | ||
./$(TARGET) |