Files
zzyxyz_go_api/README.md
zzy 36b311ff86 ```
feat(bookmark): 实现书签和文件夹的增删改查功能

- 添加 GetFolderDefaultRoot 方法用于获取默认根文件夹
- 实现 bookmark 和 folder 的请求/模型/响应转换函数
- 完善 CreateBookmark、CreateFolder、DeleteBookmark、DeleteFolder 等接口逻辑
- 支持删除空文件夹,非空文件夹禁止删除
- 修复根文件夹创建逻辑并添加错误处理
- 删除未实现的示例路由和无用代码

build: 引入 mage 构建工具支持多平台编译

- 添加 magefile.go 实现跨平台构建脚本
- 更新 go.mod 和 go.sum 引入 github.com/magefile/mage 依赖
- 在 README 中补充 mage 使用说明和 VSCode 配置

docs: 更新 README 并添加 mage 使用示例

- 添加 govulncheck 和 mage 构建相关文档
- 补充 VSCode gopls 配置说明

ci: 更新 .gitignore 忽略 bin 目录和可执行文件

- 添加 bin/ 到忽略列表
- 统一忽略 *.exe 和 *.sqlite3 文件

refactor(main): 优化主函数启动逻辑与日志输出

- 移除示例 helloworld 路由
- 设置 gin 为 ReleaseMode 模式
- 统一服务监听地址为变量,并增加启动日志提示
```
2025-09-21 15:45:37 +08:00

1.2 KiB

# https://gin-gonic.com/zh-cn/docs/quickstart/
go get -u github.com/gin-gonic/gin

# https://github.com/swaggo/gin-swagger
go install github.com/swaggo/swag/cmd/swag@latest

swag init

go get -u github.com/swaggo/gin-swagger
go get -u github.com/swaggo/files
# [link](https://github.com/oapi-codegen/oapi-codegen/?tab=readme-ov-file)
# this will then modify your `go.mod`
go get -tool github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@latest

#go:generate go tool oapi-codegen -config cfg.yaml ../../api.yaml
go tool oapi-codegen -config cfg.yaml api.yaml
# https://go-lang.org.cn/doc/tutorial/govulncheck
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...

go install github.com/magefile/mage@latest
mage -init

mage build
//go:build mage

package main

import (
    "github.com/magefile/mage/sh"
)

// Runs go mod download and then installs the binary.
func Build() error {
    if err := sh.Run("go", "mod", "download"); err != nil {
        return err
    }
    return sh.Run("go", "install", "./...")
}
// on vscode settings.json
{
  "gopls": {
    "buildFlags": ["-tags=mage"]
  }
}