cf47ef66c35fcba6e344458fcadf9a8054ba2b2c
- 修改登录接口路径为 /auth/user/{username}/login,并更新对应处理函数 - 修改注册接口路径为 /auth/user/{username},并更新对应处理函数 - 将修改密码接口从 PUT /auth/password 改为 PATCH /auth/user/{username} - 新增删除用户接口 DELETE /auth/user/{username} - 新增获取用户信息接口 GET /auth/user/{username}/info - 更新请求体结构,移除冗余的 username 字段,使用路径参数传递用户名 - 实现 DeleteUser、UpdatePassword 等新接口逻辑 - 调整 OpenAPI 文档中各接口的 operationId 和参数定义
# 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"]
}
}
Description
Languages
Go
100%