Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
banrieen 0002d0e215 | 2 years ago | |
---|---|---|
api | 2 years ago | |
build | 2 years ago | |
cmd | 2 years ago | |
configs | 2 years ago | |
deps | 2 years ago | |
docs | 2 years ago | |
internal | 2 years ago | |
.gitignore | 2 years ago | |
.gitmodules | 2 years ago | |
Jenkinsfile | 2 years ago | |
LICENSE | 2 years ago | |
Makefile | 2 years ago | |
README.md | 2 years ago | |
go.mod | 2 years ago | |
go.sum | 2 years ago | |
sonar-project.properties | 2 years ago |
internal/routers/redirect_utils.go
直接转发internal/httpclient/client.go
进行请求参考文档Standard Go Project Layout
cmd/
: 项目入口,main函数。internal/
: 业务代码。internal为不需要被外部repo调用的代码,聚合层几乎都是业务逻辑,无需被外部引用。deps/
: 本地依赖包。非公共仓库的。放在vendor文件夹执行go mod vendor
会丢失文件,故放到不被go直接管理的文件夹下api/
: openapi/swagger文档文件docs/
: 项目设计文档configs/
: config-template或默认config文件build/
: 构建代码,如Dockerfiledeployments/
: 部署代码,如k8s yaml等go.mod
, go.sum
: golang依赖管理代码Makefile
: 常用命令.gitmodules
: git submodule定义,通过git submodule add
自动生成configs
: 应用配置文件映射结构体daos
:调用数据库逻辑代码database
: 数据库驱动相关代码middlewares
:中间件,如auth等models
:数据库结构体定义requests
:请求结构体定义responses
:响应结构体定义routers
:路由管理services
:应用逻辑函数go get -u github.com/swaggo/swag/cmd/swag
$GOPATH/bin
添加到PATH
swag init -g cmd/api_server.go -o api
go run cmd/api_server.go
http://<HOST>:<PORT>/swagger/index.html
找到API文档api/
文件夹下的内容导入yapiapulis代码日常托管在自建gitlab, 但部分代码可能开源至github,故mod命名统一以github.com/apulis
开头
使用git submodule add
命令
git submodule add git@apulis-gitlab.apulis.cn:sdk/simple-gin-logger.git deps/simple-gin-logger
在go.mod添加replace,用本地deps
目录下的替换github.com/apulis
相关依赖
replace github.com/apulis/simple-gin-logger v0.0.0 => ./deps/simple-gin-logger
git submodule init
git submodule update
config.template.yaml
编辑config.yaml
文件go run cmd/api_server.go
get-deps
: 加载submodule, 并把第三方依赖下载到本地vendor/
文件夹下vet-check-all
: 使用go vet工具扫描代码(vet工具golang自带)gosec-check-all
: 使用gosec工具扫描代码(gosec工具go get github.com/securego/gosec/cmd/gosec
)build-api-server-bin
: 构建二进制文件build-api-server-docker
: 构建dockergen-swagger
: 生成swagger文档依瞳人工智能平台用户管理服务端
Text Go Dockerfile Makefile other
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》